ES 安装部署 之 句柄数配置
elasticsearch 分配的内存资源太低,无法启动,报错 too low
[2020-02-15T17:21:22,267][INFO ][o.e.x.s.a.s.FileRolesStore] [bS0fjGz] parsed [0] roles from file [/opt/ES/elasticsearch-6.3.1/config/roles.yml] [2020-02-15T17:21:22,593][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/38241] [Main.cc@109] controller (64 bit): Version 6.3.1 (Build 4d0b8f0a0ef401) Copyright (c) 2018 Elasticsearch BV [2020-02-15T17:21:22,818][DEBUG][o.e.a.ActionModule ] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security [2020-02-15T17:21:22,998][INFO ][o.e.d.DiscoveryModule ] [bS0fjGz] using discovery type [zen] [2020-02-15T17:21:23,550][INFO ][o.e.n.Node ] [bS0fjGz] initialized [2020-02-15T17:21:23,550][INFO ][o.e.n.Node ] [bS0fjGz] starting ... [2020-02-15T17:21:33,680][INFO ][o.e.t.TransportService ] [bS0fjGz] publish_address {192.168.0.88:9300}, bound_addresses {192.168.0.88:9300} [2020-02-15T17:21:33,693][INFO ][o.e.b.BootstrapChecks ] [bS0fjGz] bound or publishing to a non-loopback address, enforcing bootstrap checks 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] [2020-02-15T17:21:33,706][INFO ][o.e.n.Node ] [bS0fjGz] stopping ... [2020-02-15T17:21:33,747][INFO ][o.e.n.Node ] [bS0fjGz] stopped [2020-02-15T17:21:33,747][INFO ][o.e.n.Node ] [bS0fjGz] closing ... [2020-02-15T17:21:33,761][INFO ][o.e.n.Node ] [bS0fjGz] closed [2020-02-15T17:21:33,763][INFO ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started
解决办法:两步
第一步,修改配置文件 /etc/security/limits.conf :
[root@chxlay ~]# cd /etc/security/ [root@chxlay security]# ll 总用量 68 -rw-r--r--. 1 root root 4620 11月 6 2016 access.conf -rw-r--r--. 1 root root 82 11月 6 2016 chroot.conf drwxr-xr-x. 2 root root 4096 2月 15 12:51 console.apps -rw-r--r--. 1 root root 604 11月 6 2016 console.handlers -rw-r--r--. 1 root root 939 11月 6 2016 console.perms drwxr-xr-x. 2 root root 4096 11月 6 2016 console.perms.d -rw-r--r--. 1 root root 3635 11月 6 2016 group.conf -rw-r--r--. 1 root root 2422 11月 6 2016 limits.conf drwxr-xr-x. 2 root root 4096 2月 15 12:50 limits.d -rw-r--r--. 1 root root 1440 11月 6 2016 namespace.conf drwxr-xr-x. 2 root root 4096 11月 6 2016 namespace.d -rwxr-xr-x. 1 root root 1019 11月 6 2016 namespace.init -rw-------. 1 root root 0 11月 6 2016 opasswd -rw-r--r--. 1 root root 2972 11月 6 2016 pam_env.conf -rw-r--r--. 1 root root 1718 12月 7 2011 pwquality.conf -rw-r--r--. 1 root root 419 11月 6 2016 sepermit.conf -rw-r--r--. 1 root root 2179 11月 6 2016 time.conf
系统默认值为 65535
属性解释:
nofile - 打开文件的最大数目
noproc - 进程的最大数目
soft 指的是当前系统生效的设置值
hard 表明系统中所能设定的最大值
修改:
* hard nofile 655360 * soft nofile 131072 * hard nproc 4096 * soft nproc 2048
[root@chxlay security]# vim limits.conf
#* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 * hard nofile 655360 * soft nofile 131072 * hard nproc 4096 * soft nproc 2048 # 所有配置数据 一定要写在 之前,# End of file 否则白搭,不要以为 End of file 是一个注释,其实配置文件在他以下的都无效 # End of file # 阿里云主机则在 End of file 下面还有这段配置,以这段配置为准 root soft nofile 65535 root hard nofile 65535 * soft nofile 65535 #(需要修改为 >= 65536) * hard nofile 65535 #(需要修改为 >= 65536)
刷新配置文件(无视报错地方):source /etc/security/limits.conf
[root@chxlay security]# source /etc/security/limits.conf bash: access.conf: 未找到命令... bash: access.conf: 未找到命令... bash: access.conf: 未找到命令... bash: access.conf: 未找到命令...
第二步
修改系统配置: etc/sysctl.conf
[root@chxlay security]# cd /etc/ [root@chxlay etc]# ll sysctl.conf -rw-r--r--. 1 root root 449 8月 4 2017 sysctl.conf
vm.max_map_count=655360
fs.file-max=655360
vm.max_map_count=655360,因此缺省配置下,单个jvm能开启的最大线程数为其一半
file-max是设置 系统所有进程一共可以打开的文件数量
# sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in # /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5). vm.max_map_count=655360 fs.file-max=655360
刷新:sysctl -p
vm.max_map_count = 655360 fs.file-max = 655360
本文来自博客园,作者:Vermeer,转载请注明原文链接:https://www.cnblogs.com/chxlay/p/15114789.html