Elasticsearch集群安装部署过程中遇到的问题

一、问题:

[2019-01-12T15:55:55,433][INFO ][o.e.b.BootstrapCheck     ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

临时提高了vm.max_map_count的大小,此操作需要root权限:

sudo  sysctl -w vm.max_map_count=262144
sysctl -a|grep vm.max_map_count

永久修改vm.max_map_count:
解决:切换到root用户修改配置sysctl.conf

vim /etc/sysctl.conf 

添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。

二、问题:

2019-01-12T16:12:22,404][INFO ][o.e.b.BootstrapCheck     ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
initial heap size [536870912] not equal to maximum heap size [1073741824]; this can cause resize pauses and prevents mlockall from locking the entire heap

解决方法:

vim config/jvm.options

-Xms 和 -Xmx需要配置的相等,不然无法启动成功。
-Xms1024m -Xmx1024m

max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

编辑/etc/security/limits.conf配置文件

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

三、问题:

max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]

修改 /etc/security/limits.d/90-nproc.conf

*          soft    nproc     1024

*          soft    nproc     2048

四、问题:

system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
Your kernel does not support seccomp. 
Elasticsearch attempts to utilize seccomp by default (via the setting bootstrap.system_call_filter).
Starting in 5.2.0, if you’re in production mode, bootstrap.system_call_filter is enabled, and initializing seccomp fails, then Elasticsearch will refuse to bootstrap. 
You either have to migrate to a kernel that supports seccomp, or disable bootstrap.system_call_filter.

Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true
禁用:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:

bootstrap.memory_lock: false 
bootstrap.system_call_filter: false

五、部署

1、解压已打包文件,解压出节点文件夹
2、根据需求复制索引节点,一般包含:

195 数据节点:修改config/elasticsearch.yml配置文件内参数为 ( node.master:false)( node.data:true )

194 主节点:修改config/elasticsearch.yml配置文件内参数为 ( node.master:true)( node.data:false )

193 负载节点:修改config/elasticsearch.yml配置文件内参数为 ( node.master:false)( node.data:false )

3、修改配置文件config/elasticsearch.yml

索引名称:cluster.name(自定义,默认不用修改)

节点名称:node.name(自定义,各节点名称请勿重复,一般格式为:note-端口)

数据目录:path.data (自定义路径)

日志目录:path.logs (默认)

锁定物理内存:bootstrap.memory_lock、bootstrap.systems_call_fiter(系统是否支持,默认关闭)
网关IP:network.host(默认0.0.0.0,可根据需求自定义修改)

HTTP端口:http.port (自定义,每个节点端口请勿重复)

TCP节点内部交互端口:transport.tcp.port(自定义,每个节点端口请勿重复)

集群TCP地址:discovery.zen.ping.unicast.hosts(每个节点IP:TCP端口)

4、修改内存文件jvm.options ,最大最小内存设置数值一样,内存分配一般为服务器内存一半,如果服务器内存超大,可多部署节点,分配内存最好不超过32g。

-Xms32g
-Xms32g

六、创建用户启动

创建elsearch用户组及elsearch用户

groupadd es
useradd es -g es -p es

更改elasticsearch-10006文件夹及内部文件的所属用户及组为elsearch:elsearch

chown -R es:es   elasticsearch-10006

切换es用户
进入bin目录启动,执行以下命令启动

./elasticsearch -d

七、通过索引url查看机器状态。

1、查看各节点使用状态:

curl -XGET http://IP:端口/_cat/nodes?v&h=host,heap.current,heap.percent,heap.max,ram.max,disk.avail,node.role,*

2、查询各索引使用状态:

curl -XGET http://IP:端口/_cat/indices?v
发布了173 篇原创文章 · 获赞 113 · 访问量 30万+

猜你喜欢

转载自blog.csdn.net/superman_xxx/article/details/102720396