ES cluster version 7.3.2 online expansion Data node

background

After analyzing the role of elastic search, it is found that direct expansion of Data nodes is the simplest and can meet the demand.
Note: the original ES cluster 3 node dim role is enabled by default.

Original node information

[root@188_33_centos ~]# curl 192.168.188.33:9200/_cat/nodes
192.168.188.33 51 98 3 0.23 0.20 0.17 dim - es-33
192.168.188.39 33 97 2 0.01 0.06 0.11 dim * es-39
192.168.188.40 24 97 2 0.30 0.16 0.15 dim - es-40
[root@188_33_centos ~]# curl 192.168.188.33:9200
{
  "name" : "es-33",
  "cluster_name" : "escluster",
  "cluster_uuid" : "mc5KtwBYSh-OHX5VdW3D8g",
  "version" : {
    "number" : "7.3.2",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "1c1faf1",
    "build_date" : "2019-09-06T14:40:30.409026Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Online expansion node

Note: perform the following operations on the new nodes es-87 and es-135 respectively.

1. Set basic dependency on Java environment

[root@188-87-centos ~]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

2. Adjust hosts information

[root@188-87-centos ~]# cat /etc/hosts
192.168.188.33 es-33
192.168.188.39 es-39
192.168.188.40 es-40
192.168.188.87 es-87
192.168.188.135 es-135

3. Install elasticsearch

[root@188-87-centos ~]# rpm -ivh elasticsearch-7.3.2-x86_64.rpm 
warning: elasticsearch-7.3.2-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing...                          ################################# [100%]
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Updating / installing...
   1:elasticsearch-0:7.3.2-1          ################################# [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
 sudo systemctl start elasticsearch.service
future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/jdk/jre] does not meet this requirement
Created elasticsearch keystore in /etc/elasticsearch

4. Modify the Node configuration file

Refer to the previous node configuration file, only need to modify here node.name , network.host OK, others remain unchanged.

[root@188-87-centos elasticsearch]# cat elasticsearch.yml 
cluster.name: escluster
node.name: es-87
node.master: false
node.data: true 
path.data: /data1/esdata
path.logs: /data1/eslog
network.host: 192.168.188.87
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.188.33:9300","192.168.188.39:9300", "192.168.188.40:9300"]
cluster.initial_master_nodes: ["es-33","es-39","es-40"]
http.cors.enabled: true
http.cors.allow-origin: "*"

5. Set directory permissions

[root@188_87_centos elasticsearch]# mkdir /data1/{esdata,eslog}
[root@188_87_centos elasticsearch]# chown elasticsearch:elasticsearch /data1/esdata
[root@188_87_centos elasticsearch]# chown elasticsearch:elasticsearch /data1/eslog
[root@188_87_centos elasticsearch]# ls -lh /data1/
total 8.0K
drwxr-xr-x 2 elasticsearch elasticsearch 4.0K Jun  5 10:22 esdata
drwxr-xr-x 2 elasticsearch elasticsearch 4.0K Jun  5 10:22 eslog

6. Start Node

[root@188-87-centos elasticsearch]# systemctl enable elasticsearch.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
[root@188-87-centos elasticsearch]# systemctl start elasticsearch
[root@188-87-centos elasticsearch]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-06-05 10:25:13 CST; 5s ago
     Docs: http://www.elastic.co
 Main PID: 17417 (java)
   CGroup: /system.slice/elasticsearch.service
           ├─17417 /usr/share/elasticsearch/jdk/bin/java -Xms3g -Xmx3g -XX:+UseConcMarkSweepG...
           └─17513 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/contr...

Jun 05 10:25:13 188-87-centos systemd[1]: Started Elasticsearch.
Jun 05 10:25:13 188-87-centos systemd[1]: Starting Elasticsearch...
Jun 05 10:25:14 188-87-centos elasticsearch[17417]: OpenJDK 64-Bit Server VM warning: Opti...e.
Hint: Some lines were ellipsized, use -l to show in full.

7. Check the cluster

[root@188_33_centos elasticsearch]# curl 192.168.188.33:9200/_cat/nodes
192.168.188.40  23 98 4 0.40 0.19 0.15 dim - es-40
192.168.188.87   9 98 5 0.89 0.44 0.20 di  - es-87
192.168.188.33  57 98 7 0.17 0.22 0.21 dim - es-33
192.168.188.39  31 98 3 0.29 0.17 0.15 dim * es-39
192.168.188.135  9 63 0 0.27 0.10 0.07 di  - es-135
[root@188_33_centos elasticsearch]# curl 192.168.188.33:9200/_cluster/health?pretty
{
  "cluster_name" : "escluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 5,
  "number_of_data_nodes" : 5,
  "active_primary_shards" : 45,
  "active_shards" : 90,
  "relocating_shards" : 2,
  "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
}

summary

Find out the type of Elasticsearch node, which mainly uses Master node, Data node and Ingest node.
The master node is responsible for managing the entire cluster. It manages the state of all nodes, synchronizes the cluster state to all other nodes in the cluster periodically, and informs you of any new nodes joining the cluster and any nodes leaving the cluster. The primary node will send ping messages to all other nodes regularly to determine whether they survive normally (other nodes will also send ping messages to the primary node). One of the important tasks of the master node is configuration management. It manages all metadata, as well as the mapping of all indexes in the cluster.
The data node is responsible for saving data, merging segments, and executing queries. Data node is the real place to undertake the task in the cluster, so the configuration of the server should be higher than other nodes in the cluster.
The data processing pipeline consists of one or more ingest nodes, which are responsible for the processing of each link. Depending on the tasks that the ingest nodes are dealing with, they may need a lot of resources, so sometimes you need to specify a dedicated ingest node in the cluster.

Tags: Linux ElasticSearch CentOS Java curl

Posted on Fri, 05 Jun 2020 04:46:44 -0400 by despyz