Elasticsearch【问题记录 02】can not run elasticsearch as root + vm.max_map_count [65530] is too low 问题解决

本文涉及的产品
Elasticsearch Serverless通用抵扣包,测试体验金 200元
简介: Elasticsearch【问题记录 02】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
相关实践学习
以电商场景为例搭建AI语义搜索应用
本实验旨在通过阿里云Elasticsearch结合阿里云搜索开发工作台AI模型服务,构建一个高效、精准的语义搜索系统,模拟电商场景,深入理解AI搜索技术原理并掌握其实现过程。
ElasticSearch 最新快速入门教程
本课程由千锋教育提供。全文搜索的需求非常大。而开源的解决办法Elasricsearch(Elastic)就是一个非常好的工具。目前是全文搜索引擎的首选。本系列教程由浅入深讲解了在CentOS7系统下如何搭建ElasticSearch,如何使用Kibana实现各种方式的搜索并详细分析了搜索的原理,最后讲解了在Java应用中如何集成ElasticSearch并实现搜索。  
目录
相关文章
|
Java 关系型数据库 MySQL
Elasticsearch【问题记录 01】启动服务&停止服务的2类方法【及 java.nio.file.AccessDeniedException: xx/pid 问题解决】(含shell脚本文件)
【4月更文挑战第12天】Elasticsearch【问题记录 01】启动服务&停止服务的2类方法【及 java.nio.file.AccessDeniedException: xx/pid 问题解决】(含shell脚本文件)
1134 3
Elasticsearch【问题记录 02】【不能以root运行es + max virtual memory areas vm.max_map_count [65530] is too low处理】
【4月更文挑战第12天】Elasticsearch【问题记录 02】【不能以root运行es + max virtual memory areas vm.max_map_count [65530] is too low处理】
237 3
|
前端开发
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
182 0
|
缓存 安全
max file descriptors [65535] for elasticsearch process is too low,【已解决】
max file descriptors [65535] for elasticsearch process is too low,【已解决】
441 1
ElasticSearch6.6.2安裝使用问题记录
ElasticSearch6.6.2安裝使用问题记录
82 1
|
关系型数据库 MySQL Java
Elasticsearch【问题记录 01】启动&停止服务的2类方法及 java.nio.file.AccessDeniedException: xx/pid 问题解决(含启停shell脚本)
Elasticsearch【问题记录 01】启动&停止服务的2类方法及 java.nio.file.AccessDeniedException: xx/pid 问题解决(含启停shell脚本)
314 0
|
5月前
|
安全 Java 数据库连接
让我们讲解一下 Map 集合遍历的方式
我是小假 期待与你的下一次相遇 ~
206 43
使用 entrySet 遍历 Map 类集合 KV
使用 entrySet 遍历 Map 类集合 KV
|
存储 前端开发 API
ES6的Set和Map你都知道吗?一文了解集合和字典在前端中的应用
该文章详细介绍了ES6中Set和Map数据结构的特性和使用方法,并探讨了它们在前端开发中的具体应用,包括如何利用这些数据结构来解决常见的编程问题。
ES6的Set和Map你都知道吗?一文了解集合和字典在前端中的应用
|
Go 定位技术 索引
Go 语言Map(集合) | 19
Go 语言Map(集合) | 19

热门文章

最新文章