1-1、问题:ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
1-2、问题:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。
1-3:head插件加密访问:
这个时候需要在elasticseach.yml中增加下面几行配置即可解决。
http.cors.enabled: true
http.cors.allow-origin:’*’
http.cors.allow-headers: “Authorization”
然后在每次使用head插件的时候,按照如下的格式输入:
http://localhost:9100/?auth_user=elastic&auth_password=changeme”
其中elastic是默认账号,changeme是初始密码,均可以在x-pack插件中进行修改。
然后就能正常使用head插件了
1-4:x-pack相关——es添加配置后可以自动创建index(*-*在后面添加匹配自己定义的index格式)
#x-pack配置
action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*,*-*
1-5:安全重启集群节点的方法:
第一步:先暂停集群的shard自动均衡
curl -XPUT http://192.168.0.164:9200/_cluster/settings -d'
{"transient" : {"cluster.routing.allocation.enable" : "none"}}'
第二步:kill要升级的节点
ps aux |grep elasticsearch |awk '{print $2}' |xargs kill
第三步:恢复集群的shard自动均衡
curl -XPUT http://192.168.0.164:9200/_cluster/settings -d'
{"transient" : {"cluster.routing.allocation.enable" : "all"}}'
网友评论