Elasticsearch comes with a set of defaults that provide a good out of the box experience for development. The implicit statement there is that it is not necessarily great for production, which must be tailored for your own needs and therefore cannot be predicted.
The default settings make it easy to download and run multiple nodes on the same machine without any configuration changes.
Inside each installation of Elasticsearch is a config/elasticsearch.yml
. That is where the following settings live:
cluster.name
elasticsearch
.node.*
node.name
node.master
true
, it means that the node is an eligible master node and it can be the elected master node.true
, meaning every node is an eligible master node.node.data
true
, it means that the node stores data and handles search activity.true
.path.*
path.data
./data
.
data
will be created for you as a peer directory to config
inside of the Elasticsearch directory.path.logs
./logs
.network.*
network.host
_local_
, which is effectively localhost
.
network.bind_host
network.host
.network.publish_host
network.bind_host
, this should be the one host that is intended to be used for inter-node communication.discovery.zen.*
discovery.zen.minimum_master_nodes
(M / 2) + 1
where M
is the number of eligible master nodes (nodes using node.master: true
implicitly or explicitly).1
, which only is valid for a single node cluster!discovery.zen.ping.unicast.hosts
network.publish_host
of those other nodes.localhost
, which means it only looks on the local machine for a cluster to join.Elasticsearch provides three different types of settings:
Depending on the setting, it can be:
Always check the documentation for your version of Elasticsearch for what you can or cannot do with a setting.
You can set settings a few ways, some of which are not suggested:
In Elasticsearch 1.x and 2.x, you can submit most settings as Java System Properties prefixed with es.
:
$ bin/elasticsearch -Des.cluster.name=my_cluster -Des.node.name=`hostname`
In Elasticsearch 5.x, this changes to avoid using Java System Properties, instead using a custom argument type with -E
taking the place of -Des.
:
$ bin/elasticsearch -Ecluster.name=my_cluster -Enode.name=`hostname`
This approach to applying settings works great when using tools like Puppet, Chef, or Ansible to start and stop the cluster. However it works very poorly when doing it manually.
The order that settings are applied are in the order of most dynamic:
If the setting is set twice, once at any of those levels, then the highest level takes effect.