Elasticsearch进阶之路:集群部署
安装环境:
centos 6.8
master1.bigdata
master1.bigdata
slave1.bigdata
slave2.bigdata
slave3.bigdata
elasticsearch version 5.2.1
1、创建用户
useradd elasticsearch
passwd elasticsearch
2、创建安装目录
cd /usr/local
mkdir elasticsearch
3、下载上传安装包到服务器
https://www.elastic.co/downloads/past-releases/elasticsearch-5-2-1
4、解压
tar -xzvf elasticsearch-5.2.1.tar.gz
5、授权
chown -R elasticsearch:elasticsearch elasticsearch/
6、修改配置
vim config/elasticsearch.yml
配置
cluster.name: elasticsearch-dev
node.name: ${HOSTNAME}
network.host: 主机ip
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
http.port: 9200
discovery.zen.ping.unicast.hosts: ["172.20.86.22", "172.20.86.25", "172.20.86.27", "172.20.86.28", "172.20.86.29"]
7、启动
./bin/elasticsearch -d -d 为后台启动
**
异常处理:
**
问题一、can not run elasticsearch as root
解决:不能以root用户启动
切换用户启动
su elasticsearhc
问题二、java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
解决:centos版本问题
修改es配置
vim config/elasticsearch.yml
增加
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
问题三:ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
- soft nofile 65536
- hard nofile 131072
- soft nproc 2048
- hard nproc 4096
问题四:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
- soft nproc 1024
#修改为 - soft nproc 65535
问题五: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
问题六:max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
解决:修改切换到root用户修改配置limits.conf 添加下面两行
命令:vi /etc/security/limits.conf
-
hard nofile 65536 -
soft nofile 65536
切换到es的用户。
然后,重新启动elasticsearch,即可启动成功。
遇到的坑
新增节点时,需要清除data/nodes数据,否则加入不了集群
rm -rf data/nodes
本文详细介绍如何在CentOS 6.8上部署Elasticsearch 5.2.1集群,包括用户创建、目录设置、配置修改等步骤,并提供了解决启动过程中常见问题的方法,如权限、内存限制等问题。
401

被折叠的 条评论
为什么被折叠?



