ElasticSearch builds a cluster of cold and hot architecture (5 units)

ElasticSearch builds a cluster of cold and hot architecture (5 units)

Preparation and configuration files

Prepare 5 ES installation packages (Linux environment)
Insert picture description here
1.ES9300:

#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test01
node.master: true
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9201
transport.tcp.port: 9301
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: hot

2.ES9301 :

#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test02
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9202
transport.tcp.port: 9302
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: warm

3.ES9302 :

#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test03
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9203
transport.tcp.port: 9303
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: warm

4.ES9303 :

#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test04
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9204
transport.tcp.port: 9304
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: hot

5.ES9304

#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test05
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9205
transport.tcp.port: 9305
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: hot

Total configuration overview:
hot junction: test01,04,05
cold junction: test02,03

Start and stop cluster script

Startup script

Just replace the previous path with your own installation path, here is the background startup

#!/bin/bash
/opt/local_software/elasticsearch/es9300/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9301/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9302/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9303/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9304/bin/elasticsearch -d -p pid

Stop script

#!/bin/bash
ps -aux | grep elasticsearch | grep -v grep | awk '{print $2}' | xargs kill -9 

Verify cluster status

1. Type in the address bar:

http://192.168.135.237:9201/_cat/health?v

You can view:
Insert picture description here
2. Enter in kibana (kibana does not support cluster configuration, just configure it to the master node test01): To
configure kibana, you only need to change two items, and the others do not need to be changed:

server.host: "192.168.135.237"

# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects
# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests
# to Kibana. This setting cannot end in a slash.
#server.basePath: ""

# The maximum payload size in bytes for incoming server requests.
#server.maxPayloadBytes: 1048576

# The Kibana server's name.  This is used for display purposes.
#server.name: "your-hostname"

# The URL of the Elasticsearch instance to use for all your queries.
elasticsearch.url: "http://192.168.135.237:9201"

Visit page:

http://192.168.135.237:5601/

Enter in the Dev Tools module

GET _cat/nodeattrs?v&h=node,attr,value&s=attr:desc

The verification is complete
Insert picture description here
. Check the next article for the test of the cluster:
The principle and actual combat of cold and hot separation

Guess you like

Origin blog.csdn.net/Zong_0915/article/details/107629707