配置文件
#egrep -v "#|^$" /apps/usr/elasticsearch/config/elasticsearch.yml
cluster.name: elk
node.name: elk-112
node.master: true
node.data: true
path.data: /home/opt/elasticsearch/data
path.logs: /home/opt/elasticsearch/logs
bootstrap.memory_lock: true
indices.fielddata.cache.size: 50mb
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["10.8.18.30:9300","10.8.18.31:9300","10.8.18.32:9300"]
discovery.zen.minimum_master_nodes: 3
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: "X-Requested-With,Content-Type, Content-Length, Authorization"
内核调整
# 修改文件限制 /etc/security/limits.conf, memlock 最大锁定内存地址空间
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
elasticsearch soft nofile 65536
elasticsearch hard nofile 131072
# 修改用户的进程限制 /etc/security/limits.d/20-nproc.conf
* soft nproc 4096
root soft nproc unlimited
# /etc/sysctl.conf
# 修改最大打开文件描述符数,建议修改为655360或者更高
fs.file-max=655360
# 直接影响java线程数量,用来限制一个进程可以用于VM(虚拟内存区域大小)默认为65530,建议修改为262144或者更高
vm.max_map_count=262144
#系统调整后执行
$ sysctl -p
报错
虚拟内存不足
#最大虚拟内存区域vm.max_map_count[65530]太低,至少增加到[262144]
[1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
#调整
#fs.file-max=655360
#vm.max_map_count=262144
#sysctl -p
创建node环境错误
java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.node.Node.<init>(Node.java:298) ~[elasticsearch-6.6.2.jar:6.6.2]
at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-6.6.2.jar:6.6.2]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-
......
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.6.2.jar:6.6.2]
Caused by: java.nio.file.AccessDeniedException: /home/opt/data/elasticsearch/nodes
plugin目录无法加载插件
Could not load plugin descriptor for plugin directory [head]
删除head
即可
主节点不足
[elfk-112] not enough master nodes discovered during pinging
#discovery.zen.minimum_master_nodes: 1