Elastic Stack 7 : Elasticsearch Cluster2021/06/22 |
Configure Elasticsearch Cluster.
This example shows to configure Elasticsearch Cluster with 3 Nodes and configure each Node is Master Eligible Node and Data Node (default).
Each node serves one or more purpose, refer to details below.⇒ https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html |
|
[1] |
Install and Run Elasticsearch on all Nodes. (installation only)
|
[2] | Change settings on all Nodes like follows. |
[root@node01 ~]#
vi /etc/elasticsearch/elasticsearch.yml # line 17 : uncomment and change (any name you like) cluster.name: elastic-cluster
# line 23 : uncomment and change (set Hostanme for node name) node.name: ${HOSTNAME}
# line 56 : uncomment and change (listen all) network.host: 0.0.0.0
# line 71 : add (specify all Nodes - the Nonde name should be the same with [node.name] discovery.seed_hosts: - "node01.srv.world" - "node02.srv.world" - "node03.srv.world" # line 79 : add (specify all Nodes - the Nonde name should be the same with [node.name] cluster.initial_master_nodes: - "node01.srv.world" - "node02.srv.world" - "node03.srv.world" systemctl enable --now elasticsearch |
[3] | If Firewalld is running, allow service ports. |
[root@node01 ~]# firewall-cmd --add-port={9200/tcp,9300/tcp} --permanent success [root@node01 ~]# firewall-cmd --reload success |
[4] | Verify Cluster status. If the status is green, That's OK. |
[root@node01 ~]# curl http://10.0.0.51:9200/_cat/nodes?v ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name 10.0.0.52 8 90 2 0.06 0.27 0.37 cdfhilmrstw - node02.srv.world 10.0.0.53 18 90 2 0.01 0.16 0.14 cdfhilmrstw * node03.srv.world 10.0.0.51 14 90 7 0.19 0.15 0.11 cdfhilmrstw - node01.srv.world[root@node01 ~]# curl http://10.0.0.51:9200/_cluster/health?pretty { "cluster_name" : "elastic-cluster", "status" : "green", "timed_out" : false, "number_of_nodes" : 3, "number_of_data_nodes" : 3, "active_primary_shards" : 0, "active_shards" : 0, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 0, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 100.0 } |
Sponsored Link |
|