Since you have learned a major part of cluster configuration, let's begin to create a full-blown production-ready cluster. In this example, we will configure a cluster with three master, two client nodes, and two data nodes.
The example shows a configuration of one master, one data, and one client node. On the rest of nodes, all the configuration will remain the same according to the node category, but only four parameters will be changed:
node.name
, path.data
, path.log
and network.host
.
Configuring master nodes
cluster.name: "production-cluster" node.name: "es-master-01" node.data: false node.master: true path.data: "path_to_data_directory" network.host: "192.168.1.10" (should be changed to a private IP address of this machine or can be left out too, because Elasticsearch, by default, binds itself to the 0.0.0.0 address) http.enabled: false transport.tcp.port: 9300 discovery.zen.minimum_master_nodes: 3 discovery.zen.ping.unicast.hosts: ["es-master-01:6300","es-master-02:6300", "es-master-03:6300"] discovery.zen.ping.timeout: 5s bootstrap.mlockall: true action.destructive_requires_name: true #For allowing script execution script.inline: on
cluster.name: "production-cluster" node.name: "es-client-01" node.data: false node.master: false network.host: "192.168.1.10" (should be changed to the private IP address of this machine) http.enabled: true http.port: 9200 transport.tcp.port: 9300 discovery.zen.minimum_master_nodes: 3 discovery.zen.ping.unicast.hosts: ["es-master-01:9300","es-master-02:9300", "es-master-03:9300"] discovery.zen.ping.timeout: 5s bootstrap.mlockall: true action.destructive_requires_name: true action.disable_delete_all_indices: false script.inline: on #To allow sense and marvel to query elasticsearch http.cors.enabled: true http.cors.allow-origin: /http://localhost(:[0-9]+)?/ http.cors.allow-credentials: true
Configuring data nodes
cluster.name: "production-cluster" node.name: "es-data-01" node.data: true node.master: false network.host: "192.168.1.10" (should be changed to the private IP address of this machine) http.enabled: false transport.tcp.port: 9300 discovery.zen.minimum_master_nodes: 3 discovery.zen.ping.unicast.hosts: ["es-master-01:9300","es-master-02:9300", "es-master-03:9300"] discovery.zen.ping.timeout: 5s bootstrap.mlockall: true action.destructive_requires_name: true script.inline: on