Configuring Elasticsearch
After installing Elasticsearch it needs the following configuration changes before it can be used productively.
Precondition: make sure your machine has a fixed IP address.
Edit /etc/sysctl.config:
Configuration Task | |
---|---|
Reduce the kernel’s tendency to swap. Still allow to swap in emergency conditions. | Set vm.swappiness=1 |
Edit /etc/elasticsearch/jvm.options:
Configuration Task | |
---|---|
Set the Java heap size to half of the available memory but not greater than 16 GB | Example for 2 GB: -Xms2g |
Edit /etc/elasticsearch/elasticsearch.yml:
Configuration Task | |
---|---|
Make Elasticsearch node accessible under a public IP address (instead of localhost only) | Set network.host to your fixed IP address Retrieve IP address information using /sbin/ifconfig |
Ensure that your Elasticsearch nodes are in the same Elasticsearch cluster and don't influence other Elasticsearch installations | Set cluster.name to something unique, e.g. ElasticDigaSystem |
Give your node a unique (and self-explaining name) | Set node.name to something unique, e.g. DigaSystemNode1 |
Prevent wildcard deleting of indices | Set action.destructive_requires_name to true |
Disable automatic index creation | Set action.auto_create_index to 0 Breaking change in Elasticsearch 6.x: Set action.auto_create_index to ".watches,.triggered_watches,.watcher-history-*" |
Links with more detailed information: