Centos 部署 Elasticsearch 6.2.3

1. 下载

2. 环境

2.1 Java环境

2.2 创建用户

如果用root用户启动elasticsearch的话,会报错,故需要创建普通用户

useradd es   # 创建es用户
chown -R es:es $ES_HOME 

3.启动

su es
$ES_HOME/bin/elasticsearch

4. 问题

4. 1 network.host (多网卡集群和内外网访问设置)

内网 elasticsearch 集群 外网可以访问。假定内网ip为192.168.1.1,外网ip为 10.x.x.x

  • 1)设置 host 为 0.0.0.0 ,即可启用该物理机器所有网卡网络访问

    network.host: 0.0.0.0
    

    测试,内外网均可访问,但是内网网络不可以和内网中其他节点组成集群。

    但是,该机器和内网段的其他节点不能集群,多个IP导致脑裂,原因未知,没有深入研究。

  • 2)分别设置绑定网络(访问)和公共集群网络(集群连接)

    network.bind_host: ["192.168.1.1","10.x.x.x"]
    network.publish_host: 192.168.1.1
    

    启动后,日志会打印如下记录,说明ip绑定成功:

    [2018-05-14T08:39:08,974][INFO ][o.e.t.TransportService   ] [es-1] publish_address {192.168.1.1:9300}, bound_addresses {192.168.1.1:9300}, {10.x.x.x:9300}
    

    这种方式就可以达到内网 elasticsearch 集群 外网可以访问,且不会出现脑裂问题

4.2 system call filters failed to install

ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

这是在因为Centos6不支持SecComp,而ES5.6.4默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

解决方案:

在elasticsearch.yml中配置如下:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

4.3 max number of threads

ERROR: bootstrap checks failed
max number of threads [1024] for user [elasticsearch] is too low, increase to at least [4096]

解决方案:

切换root用户,/etc/security/limits.conf 添加

* soft nofile 65536
* hard nofile 65536
* soft nproc 65535
* hard nproc 65535

4.4 max virtual memory

max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

解决方案:

切换到root用户修改配置/etc/sysctl.conf

vm.max_map_count=262144

执行命令

sysctl -p
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容