问题场景:
MAC为了配置elasticsearch-head,使用这个插件检查各个节点的健康度。
配置过程:
第一步:进入es安装目录下的config目录,修改elasticsearch.yml文件.在文件的末尾加入以下代码
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
然后去掉network.host: 192.168.0.1的注释并改为network.host: 0.0.0.0,
去掉cluster.name;node.name;http.port的注释
第二步:重启elasticsearch
到这就开始出现错误了:
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2019-06-03T07:05:44,761][INFO ][o.e.n.Node ] [hz] stopping ...
[2019-06-03T07:05:44,788][INFO ][o.e.n.Node ] [hz] stopped
[2019-06-03T07:05:44,788][INFO ][o.e.n.Node ] [hz] closing ...
[2019-06-03T07:05:44,801][INFO ][o.e.n.Node ] [hz] closed
[2019-06-03T07:05:44,804][INFO ][o.e.x.m.p.NativeController] [hz] Native controller process has stopped - no new native processes can be started
解决办法:
[root@localhost ~]# vi /etc/security/limits.conf在文件的末尾加上esyonghu soft nofile 65536
esyonghu hard nofile 65536
esyonghu soft nproc 4096
esyonghu hard nproc 4096
再
[root@localhost security]# vi /etc/sysctl.conf
加上下面这句到sysctl.conf
vm.max_map_count = 655360然后下面的语句让上面的内容生效
[root@localhost security]# sysctl -p #对于上面的内容让其生效
这是语句输出的效果,如果有输出代表生效了
vm.max_map_count = 655360
如果这时候还是发现不行,请看下面(当然上面的也要做完):
##修改config/elasticsearch.yml下约第68行注释,ip替换host1等,多节点请添加多个ip地址,单节点可写按默认来
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值(主要是这句,你可以先把这句的注释去掉,看看行不行,一般去掉这个注释都能成功!)