centos7安装Elasticsearch6.2.4

本文介绍了在CentOS 7环境中启动Elasticsearch时遇到的三个常见错误:最大文件描述符过低、最大线程数过低及最大虚拟内存区域不足,并提供了详细的解决步骤。此外,还介绍了如何通过配置network.host使Elasticsearch支持IP地址访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

elasticsearch启动报错

在centos7中使用wget 下载elasticsearch安装

wget  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz

 解压       

tar -zxvf elasticsearch-6.2.4.tar.gz

在启动过程 中会遇到这两个问题

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

第一个原因 

[1]: max file descriptors [4096] for elasticsearch process is 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)
   保存、退出、重新登录才可生效

第二个

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

原因:无法创建本地线程问题,用户最大可创建线程数太小

解决方案:切换到root用户,进入limits.d目录下,修改20-nproc.conf 配置文件。
vi /etc/security/limits.d/20-nproc.conf
找到如下内容:

* soft nproc 2048

#修改为

* soft nproc 4096

 第三个

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

原因:最大虚拟内存太小 

解决方案:切换到root用户下,修改配置文件sysctl.conf
vi /etc/sysctl.conf
添加下面配置:

vm.max_map_count=655360

并执行命令:
sysctl -p
然后重新启动elasticsearch,即可启动成功。

 

IP访问不了,localhost可以访问

还有个问题,在启动的时候服务器用localhost:9200访问,用ip访问不了

 修改elasticsearch.yml中network.host,打开这一行的注释,就能成功用ip端口访问服务器

network.host: 0.0.0.0

 

 

文章参考 https://github.com/DimonHo/DH_Note/issues/3

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值