https://www.elastic.co/guide/en/elasticsearch/reference/5.6/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
1、 System environment
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 environment
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、 installation
rpm -qa |grep elas
elasticsearch-5.6.8-1.noarch
Note that memory locking needs to be configured in the Centos7.4 service, and the file /etc/systemd/system/elasticsearch.service.d/override.conf needs to be modified. Reference https://www.elastic.co/guide/en/elasticsearch/reference/master/setting-system-settings.html
EDITOR=vim systemctl edit elasticsearch
[ Service]
LimitMEMLOCK=infinity
2、 Configuration
Note that the default configuration is fine. Most of the parameters are just by default. The official tuning has been done. Especially in Centos7, there is no need to add them in the configuration file. Only those configurations that must be modified according to the actual situation need to be filled in.
1 ), master node configuration
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 node configuration
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 tuning
By default, only the size of HEAP needs to be adjusted, preferably no more than 50% of the memory, and no more than 31G for large memory servers
cat /etc/elasticsearch/jvm.options |egrep 'Xms|Xmx'
- Xms14g
- Xmx14g
3、 boot
systemctl enable elasticsearch
View 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
View nodes status curl http://172.20.3.20:9200/_nodes/stats?pretty View cluster health status 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
Find index curl http://172.20.3.20:9200/_cat/indices?bytes=b | sort -rnk8 |grep -V marvel
View settings curl http://172.20.3.20:9200/_cluster/settings?pretty
Recommended Posts