配置文件
# 集群名称
cluster.name: es-cluster-5.3.1
# 节点名称
node.name: node-3
# Master资格
node.master: true
# 存储数据
node.data: true
# 本机ip
network.host: 0.0.0.0
# 端口
http.port: 9200
# 节点之间的通信
transport.tcp.port: 9300
# 集群ip
discovery.zen.ping.unicast.hosts: [“172.16.31.220”, “172.16.31.221”,“172.16.31.224”]
# 有Master资格的节点 官方推荐 (n/2)+1
discovery.zen.minimum_master_nodes: 3
# ping等待时间
discovery.zen.ping_timeout: 3
遇到的问题
问题一
Elasticsearch不能使用root用户运行
新建用户:
useradd elastic
passwd elastic
问题二
ERROR: bootstrap checks failed max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
原因:无法创建本地文件问题,用户最大可创建文件数太小
解决方案:
切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:
vi /etc/security/limits.conf
添加如下内容:
- soft nofile 65536
- hard nofile 131072
- soft nproc 2048
- hard nproc 4096
备注:* 代表Linux所有用户名称(比如 hadoop)
保存、退出、重新登录才可生效
问题三
ERROR:max number of threads [1024] for user [es] likely too low, increase to at least [2048]
原因:无法创建本地线程问题,用户最大可创建线程数太小
解决方案:
切换到root用户,进入limits.d目录下,修改90-nproc.conf 配置文件。
vi /etc/security/limits.d/90-nproc.conf
找到如下内容:
- soft nproc 1024
#修改为 - soft nproc 2048
问题四
ERROR: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