elasticsearch踩坑

  • 问题一

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
配置 /etc/sysctl.conf

1
2
$ vi /etc/sysctl.conf
vm.max_map_count=262144

生效

1
$ sysctl -p

验证

1
$ sysctl -a|grep vm.max_map_count

  • 问题二

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
max number of threads [1024] for user [XXX] is too low,increase to least [2048]
1、修改 nofile 时候,需要在 /etc/sysctl.conf/etc/security/limits.conf 配置,其中 /etc/sysctl.conf 中配置的值需要比 /etc/security/limits.conf 的值大 。

配置 /etc/sysctl.conf

1
2
$ vi /etc/sysctl.conf 
fs.file-max = 512000

生效

1
$ sysctl -p

配置 /etc/security/limits.conf

1
2
$ vi /etc/security/limits.conf
elasticsearch - nofile 65536

或者

1
* - nofile 65536

2、修改 nofilenproc
CentOS 7nproc 的修改在 /etc/security/limits.d/20-nproc.conf,为了方便在 /etc/security/limits.conf/etc/security/limits.d/20-nproc.conf 文件里面同时都添加了 。

配置 /etc/security/limits.conf

1
2
$ vi /etc/security/limits.conf
* - nproc 65536

配置 /etc/security/limits.d/20-nproc.conf

1
2
3
$ vi /etc/security/limits.d/20-nproc.conf
* - nofile 65536
* - nproc 65536

重启系统,验证

1
$ ulimit -Hn

总结:

1
2
3
4
5
6
7
8
9
10
11
$ vi /etc/sysctl.conf
vm.max_map_count=262144
fs.file-max=512000

$ vi /etc/security/limits.conf
elasticsearch - nofile 65536
* - nproc 65536

$ vi /etc/security/limits.d/20-nproc.conf
* - nofile 65536
* - nproc 65536

  • 本文作者: forever杨
  • 本文链接: https://blog.yl-online.top/posts/19540ce1.html
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。如果文章内容对你有用,请记录到你的笔记中。本博客站点随时会停止服务,请不要收藏、转载!