elasticsearch-6.2.4 linux安装

本文详细介绍如何在CentOS 7环境下部署Elasticsearch,并针对常见的启动错误进行了解决,包括禁止root用户启动、调整目录权限、修正vm.max_map_count及maxfile descriptors等配置。

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

1 运行环境

虚拟机  centos 7   内存2G

2 创建用户

elasticsearch 不允许使用 root 启动

# 加账户 
[root@localhost bin]# adduser es 
# 设置密码 
[root@localhost bin]# passwd es 
# 切换账户
[root@localhost bin]# su es

3 修改目录权限

[root@localhost local]# chown es:es /usr/local/elasticsearch-6.2.4/ -R

4 root 启动报错

[root@localhost bin]# ./elasticsearch
[2018-09-06T00:05:27,296][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

切换成 es 用户启动

5 vm.max_map_count 错误

ERROR: [2] bootstrap checks failed
[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,当前生效,开机消失
[root@localhost bin]# sysctl -w vm.max_map_count=262144 
vm.max_map_count = 262144


# 方法2:开机生效
[root@localhost bin]# vim /etc/profile
# 最后追加内容
sysctl -w vm.max_map_count=262144
# 立即生效
[root@localhost bin]# source /etc/profile

5 max file descriptors 错误

ERROR: [1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

 解决方案:

# 修改文件
vim /etc/security/limits.conf 
# 追加内容
es hard nofile 65536 
es soft nofile 65536 

6  启动

[es@localhost bin]$ ./elasticsearch

7 查看进程

ps aux|grep elasticsearch

8 访问网址

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值