这里要说的有一点,es默认是开发者模式,如果要开启生产模式就是修改elasticsearch中的配置,至于开发者模式和生产模式的区别请查看官网。。这里就不说明了,至于我为啥要开启是因为我要写程序去调用es统计数据,但默认是127.0.0.1:9200 只能本机。。
修改配置,注意:后面要带一个空格
vim /data/elasticsearch-6.5.3/config/elasticsearch.yml
network.host: 0.0.0.0
如果修改两network.host 报以下错误:
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: Transport SSL must be enabled for setups with production licenses. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]
则再需两个步骤:
步骤1、需要在配置中再开启一个设置:
vim /data/elasticsearch-6.5.3/config/elasticsearch.yml
xpack.security.transport.ssl.enabled: true
步骤2、修改系统环境变量
使用ulimit -n查看最大可打开文件数,上面提示我们需要设置为65536,默认4096
执行以下命令或者打开文件设置,注意,重启后生效
echo 'DefaultLimitNOFILE=65536' >> /etc/systemd/system.conf
echo 'DefaultLimitNPROC=65535' >> /etc/systemd/system.conf
reboot
执行完这些后,再重启es服务,可能日志中会报错一段时间,过一段时间就好了。