Linux环境 安装 elasticsearch can not run elasticsearch as root + vm.max_map_count [65530] is too low 问题(
Posted シ風箏
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux环境 安装 elasticsearch can not run elasticsearch as root + vm.max_map_count [65530] is too low 问题(相关的知识,希望对你有一定的参考价值。
异常一
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
异常一解决
添加 elasticsearch 用户组和用户:
[root@tcloud ~]# groupadd elasticsearch
[root@tcloud ~]# useradd -g elasticsearch elasticsearch
# 设置密码
[root@tcloud ~]# echo "elasticsearch" | passwd elasticsearch --stdin
将ES的文件转到 elasticsearch 下:
[root@tcloud ~]# cd /usr/local/elasticsearch
[root@tcloud ~]# chown -R elasticsearch .
[root@tcloud ~]# chgrp -R elasticsearch .
[root@tcloud elasticsearch]# ll
total 448
drwxr-xr-x 3 elasticsearch elasticsearch 4096 Jul 31 11:22 bin
drwxr-xr-x 2 elasticsearch elasticsearch 4096 Jul 31 12:16 config
drwxr-xr-x 3 elasticsearch elasticsearch 4096 Oct 31 2018 lib
-rw-r--r-- 1 elasticsearch elasticsearch 13675 Oct 31 2018 LICENSE.txt
drwxr-xr-x 2 elasticsearch elasticsearch 4096 Jul 31 12:01 logs
drwxr-xr-x 27 elasticsearch elasticsearch 4096 Oct 31 2018 modules
-rw-r--r-- 1 elasticsearch elasticsearch 401465 Oct 31 2018 NOTICE.txt
drwxr-xr-x 2 elasticsearch elasticsearch 4096 Oct 31 2018 plugins
-rw-r--r-- 1 elasticsearch elasticsearch 8519 Oct 31 2018 README.textile
修改 sudoers 文件,给用户 elasticsearch 添加 sudo 权限:
[root@tcloud ~]# vim /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
# 添加elasticsearch
elasticsearch ALL=(ALL) ALL
启动时切换到 elasticsearch 用户下。
异常二
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
异常二解决
# 查看系统环境变量vm.max_map_count
[root@tcloud ~]# sysctl -a | grep vm.max_map_count
vm.max_map_count = 65530
# 修改系统环境变量vm.max_map_count
[root@tcloud ~]# vim /etc/sysctl.conf
# 末尾添加
vm.max_map_count = 262144
# 配置文件修改完后需要重启才能生效 可使用下面命令使得本次启动有效
[root@tcloud ~]# sysctl -w vm.max_map_count=262144
vm.max_map_count = 262144
修改最大文件描述符数量和用户最大线程数
[root@tcloud ~]# vim /etc/security/limits.conf
# 添加下面代码至文件末尾:
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
以上是关于Linux环境 安装 elasticsearch can not run elasticsearch as root + vm.max_map_count [65530] is too low 问题(的主要内容,如果未能解决你的问题,请参考以下文章
linux环境 [ubuntu麒麟等系统] 安装Elasticsearch分布式存储集群及配置
Linux环境CentOS6.9安装配置Elasticsearch6.2.2最全详细教程
Linux环境下安装Elasticsearch,史上最详细的教程来啦~
Linux安装ElasticSearch与MongoDB分布式集群环境下数据同步
Linux环境 安装 elasticsearch can not run elasticsearch as root + vm.max_map_count [65530] is too low 问题(