Elastic Search 7.1.1 Cluster Building

Posted by neoform on Wed, 07 Aug 2019 07:58:26 +0200

1. Cluster Introduction:
First, three Elastic Search servers are required, and Elastic Search 7.1.1 is successfully installed. After successful installation, three Elastic Search services are started respectively (see Installation Method: Elastic search installation tutorial After service start-up, all three services can be used normally. Next we can configure the Elastic Search cluster on this basis, which is used to save data and can be selected as the master node.
Service Version:

service Edition
elasticsearch 7.1.1
jdk 1.8

2. Elastic search.yml configuration description:

parameter Explain
cluster.name Cluster name, same name as a cluster
node.name Node name, each node name is unique in cluster mode
node.master Whether the current node can be elected master node is: true, no: false
node.data Whether the current node is used to store data is: true, no: false
path.data Location of index data storage
path.logs Location of log files
bootstrap.memory_lock Requirements lock physical memory: true, no: false
bootstrap.system_call_filter SecComp test: true, no: false
network.host Monitor address for accessing the es
network.publish_host It can be set up as intranet ip for communication between machines in cluster
http.port es External http port, default 9200
transport.tcp.port TCP default listening port, default 9300
discovery.seed_hosts Additional configuration after es7.x to write the device address of the candidate primary node, which can be selected as the primary node after the service is started
cluster.initial_master_nodes Additional configuration after es7.x, which is required to elect master when initializing a new cluster
http.cors.enabled Whether cross-domain is supported is: true, this configuration is required when using the head plug-in
http.cors.allow-origin "*" indicates support for all domain names

3. Cluster building:
3.1, Node 1 Configuration: Set elastic search.yml

# Setting the cluster name
cluster.name: myes
# Setting Node Name
node.name: node1
# Represents that the node will not be the primary node
node.master: true
# Whether the current node is used to store data is: true, no: false
node.data: true
# Location of index data storage
path.data: /opt/elasticsearch/data
# Location of log files
path.logs: /opt/elasticsearch/logs
# Requirements lock physical memory: true, no: false
bootstrap.memory_lock: true
# Monitor address for accessing the es
network.host: 172.16.100.1
# es External http port, default 9200
http.port: 9200
# TCP default listening port, default 9300
transport.tcp.port: 9300
# Set this parameter to ensure that the nodes in the cluster know the other N master qualified nodes. The default is 1. For large clusters, you can set a larger value (2-4)
discovery.zen.minimum_master_nodes: 2
# Additional configuration after es7.x to write the device address of the candidate primary node, which can be selected as the primary node after the service is started
discovery.zen.ping.unicast.hosts: ["172.16.100.1:9300","172.16.100.2:9300","172.16.100.3:9300"] 
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5
# Additional configuration after es7.x, which is required to elect master when initializing a new cluster
cluster.initial_master_nodes: ["node1","node2","node3"]
# Whether cross-domain is supported is: true, this configuration is required when using the head plug-in
http.cors.enabled: true
# "*" indicates support for all domain names
http.cors.allow-origin: "*"

3.2, Node 2 Configuration: Setting elastic search.yml

# Setting the cluster name
cluster.name: myes
# Setting Node Name
node.name: node2
# Represents that the node will not be the primary node
node.master: true
# Whether the current node is used to store data is: true, no: false
node.data: true
# Location of index data storage
path.data: /opt/elasticsearch/data
# Location of log files
path.logs: /opt/elasticsearch/logs
# Requirements lock physical memory: true, no: false
bootstrap.memory_lock: true
# Monitor address for accessing the es
network.host: 172.16.100.2
# es External http port, default 9200
http.port: 9200
# TCP default listening port, default 9300
transport.tcp.port: 9300
# Set this parameter to ensure that the nodes in the cluster know the other N master qualified nodes. The default is 1. For large clusters, you can set a larger value (2-4)
discovery.zen.minimum_master_nodes: 2
# Additional configuration after es7.x to write the device address of the candidate primary node, which can be selected as the primary node after the service is started
discovery.zen.ping.unicast.hosts: ["172.16.100.1:9300","172.16.100.2:9300","172.16.100.3:9300"] 
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5
# Additional configuration after es7.x, which is required to elect master when initializing a new cluster
cluster.initial_master_nodes: ["node1","node2","node3"]
# Whether cross-domain is supported is: true, this configuration is required when using the head plug-in
http.cors.enabled: true
# "*" indicates support for all domain names
http.cors.allow-origin: "*"

3.3, Node 3 Configuration: Set up elastic search.yml

# Setting the cluster name
cluster.name: myes
# Setting Node Name
node.name: node3
# Represents that the node will not be the primary node
node.master: true
# Whether the current node is used to store data is: true, no: false
node.data: true
# Location of index data storage
path.data: /opt/elasticsearch/data
# Location of log files
path.logs: /opt/elasticsearch/logs
# Requirements lock physical memory: true, no: false
bootstrap.memory_lock: true
# Monitor address for accessing the es
network.host: 172.16.100.3
# es External http port, default 9200
http.port: 9200
# TCP default listening port, default 9300
transport.tcp.port: 9300
# Set this parameter to ensure that the nodes in the cluster know the other N master qualified nodes. The default is 1. For large clusters, you can set a larger value (2-4)
discovery.zen.minimum_master_nodes: 2
# Additional configuration after es7.x to write the device address of the candidate primary node, which can be selected as the primary node after the service is started
discovery.zen.ping.unicast.hosts: ["172.16.100.1:9300","172.16.100.2:9300","172.16.100.3:9300"] 
discovery.zen.fd.ping_timeout: 1m
discovery.zen.fd.ping_retries: 5
# Additional configuration after es7.x, which is required to elect master when initializing a new cluster
cluster.initial_master_nodes: ["node1","node2","node3"]
# Whether cross-domain is supported is: true, this configuration is required when using the head plug-in
http.cors.enabled: true
# "*" indicates support for all domain names
http.cors.allow-origin: "*"

3.4. Start three elastic search services respectively. Enter http://172.16.100.1:9200/_cat/nodes in the browser and execute the results shown in the following figure to indicate that the configuration is successful.

Topics: ElasticSearch network JDK