ES集羣7.3.2版本在線擴容Data節點

背景

接到生產業務需求,須要在線擴容ES集羣且不能影響數據安全性,通過對Elasticsearch角色的分析,發現直接擴容Data節點最簡單並且能知足需求。
備註:原來ES集羣3節點dim角色默認都開啓了。java

原節點信息node

[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"
}

在線擴容節點

備註:分別在新增節點es-87與es-135上執行以下操做。linux

1.設置基本依賴Java環境centos

[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.調整hosts信息安全

[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.安裝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.修改Node節點配置文件cors

參考以前節點配置文件,這裏只須要修改node.name、network.host便可,其餘保持不變。curl

[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.設置目錄權限elasticsearch

[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.啓動Node節點ide

[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.檢查集羣狀況

[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
}

總結

弄清Elasticsearch節點類型,這裏主要用到Master節點、 Data節點、 Ingest節點。主節點負責管理整個集羣。它管理全部節點的狀態,並週期性地將集羣狀態同步到集羣中的全部其餘節點,通知你們有什麼新節點加入了集羣,有什麼節點脫離了集羣。主節點會按期向全部其餘節點發送ping消息,以此判斷它們是否正常存活(別的節點也會向主節點發送ping消息)。主節點的重要任務之一是配置管理。它管理着所有元數據,以及集羣中全部索引的映射。數據節點負責保存數據、段合併和執行查詢。數據節點是集羣中真正承擔工做任務的地方,所以服務器的配置應該比集羣中的其餘節點高。數據處理管道由一到多個ingest節點組成,由ingest節點負責每一個環節的處理。依ingest節點要處理的任務不一樣,它們可能會須要不少資源,所以有時候須要在集羣中指定專用的ingest節點。

相關文章
相關標籤/搜索