Elasticsearch进阶之路:集群部署

本文详细介绍如何在CentOS 6.8上部署Elasticsearch 5.2.1集群,包括用户创建、目录设置、配置修改等步骤,并提供了解决启动过程中常见问题的方法,如权限、内存限制等问题。

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


参考:《Elasticsearch 权威指南》中文版

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值