Centos7.4部署配置Elasticsearch6.3.2集群

參考文檔 https://www.elastic.co/guide/en/elasticsearch/reference/6.3/index.html

https://www.elastic.co/guide/cn/elasticsearch/guide/current/important-configuration-changes.html
https://www.elastic.co/guide/en/elasticsearch/reference/master/setting-system-settings.html

一、環(huán)境

1、系統(tǒng)環(huán)境

cat /etc/security/limits.conf
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
elasticsearch soft nofile 131072
elasticsearch hard nofile 131072
elasticsearch soft nproc 4096
elasticsearch hard nproc 4096

2、JAVA環(huán)境

java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

二、安裝配置

1、安裝
rpm -qa |grep elas
elasticsearch-6.3.2-1.noarch

注意事項
a.注意Centos7.4服務(wù)里面需要配置內(nèi)存鎖定,需要修改文件/etc/systemd/system/elasticsearch.service.d/override.conf 參考https://www.elastic.co/guide/en/elasticsearch/reference/master/setting-system-settings.html
[root@elasticsearch01 ~]# EDITOR=vim systemctl edit elasticsearch
[Service]
LimitMEMLOCK=infinity
[root@elasticsearch01 ~]# systemctl daemon-reload

b.JAVA路徑等要和系統(tǒng)環(huán)境保持一致
[root@elasticsearch01 ~]# cat /etc/sysconfig/elasticsearch |grep -Ev "#|$"
JAVA_HOME=/usr/local/jdk
ES_PATH_CONF=/etc/elasticsearch
ES_STARTUP_SLEEP_TIME=5

2、配置

注意配置使用默認(rèn)的就行,大部分參數(shù)都是按照默認(rèn)即可,官方已經(jīng)調(diào)優(yōu)過了,特別是Centos7里面,不需要在配置文件里面添加,只有那些必須要根據(jù)實際情況修改的配置需要填寫。

1)、master節(jié)點配置

cat /etc/elasticsearch/elasticsearch.yml
cluster.name: roobo-escluster
node.name: master-01
node.master: true
node.ingest: true
node.data: false
path.data: /data/es-data01,/data/es-data02
path.logs: /data/es-data01/eslogs
bootstrap.memory_lock: true
network.host: 172.20.3.17
http.port: 9200
discovery.zen.ping.unicast.hosts: ["172.20.3.17:9300","172.20.3.18:9300","172.20.3.19:9300"]
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 6
gateway.expected_nodes: 8
gateway.recover_after_time: 5m
http.cors.enabled: true
http.cors.allow-origin: "*"

2)、data節(jié)點配置

cat /etc/elasticsearch/elasticsearch.yml
cluster.name: roobo-escluster
node.name: data-01
node.master: false
node.ingest: false
node.data: true
path.data: /data/es-data01,/data/es-data02
path.logs: /data/es-data01/eslogs
bootstrap.memory_lock: true
network.host: 172.20.3.20
http.port: 9200
discovery.zen.ping.unicast.hosts: ["172.20.3.17:9300","172.20.3.18:9300","172.20.3.19:9300"]
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 6
gateway.expected_nodes: 8
gateway.recover_after_time: 5m
http.cors.enabled: true
http.cors.allow-origin: "*"

3)、jvm調(diào)優(yōu)

默認(rèn)只需要調(diào)整HEAP大小,最好不超過內(nèi)存的50%,大內(nèi)存服務(wù)器不超過31G

cat /etc/elasticsearch/jvm.options |egrep 'Xms|Xmx'
-Xms14g
-Xmx14g

3、開機啟動

systemctl enable elasticsearch

三、Elasticsearch常見操作

查看nodes

curl http://172.20.3.20:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.20.3.20 4 57 0 0.04 0.03 0.05 d - data-01
172.20.3.18 4 60 0 0.05 0.03 0.05 mi - master-02
172.20.3.24 5 57 0 0.00 0.01 0.05 d - data-05
172.20.3.19 9 38 0 0.02 0.02 0.05 mi - master-03
172.20.3.21 4 57 0 0.00 0.02 0.05 d - data-02
172.20.3.23 5 57 0 0.00 0.01 0.05 d - data-04
172.20.3.22 3 57 0 0.00 0.01 0.05 d - data-03
172.20.3.17 4 68 0 0.00 0.01 0.05 mi * master-01

查看nodes狀態(tài) curl http://172.20.3.20:9200/_nodes/stats?pretty 查看集群健康狀態(tài) curl http://172.20.3.20:9200/_cluster/health?pretty
curl http://172.20.3.20:9200/_cluster/health?level=indices
curl http://172.20.3.20:9200/_cluster/health?level=shards
查找索引 curl http://172.20.3.20:9200/_cat/indices?bytes=b | sort -rnk8 |grep -V marvel
查看設(shè)置 curl http://172.20.3.20:9200/_cluster/settings?pretty

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容