elasticsearch,Java,Linux,elasticsearch" /> elasticsearch,Java,Linux,elasticsearch" />

Java elasticsearch进程的最大文件描述符太低

Java elasticsearch进程的最大文件描述符太低,java,linux,elasticsearch,Java,Linux,elasticsearch,无法解决这些问题: [2017-10-16T13:54:23,381][WARN ][o.e.b.BootstrapChecks ] [node-1] max file descriptors [65000] for elasticsearch process is too low, increase to at least [65536] [2017-10-16T13:54:23,382][WARN ][o.e.b.BootstrapChecks ] [node-1] max

无法解决这些问题:

[2017-10-16T13:54:23,381][WARN ][o.e.b.BootstrapChecks    ] [node-1] max 
file descriptors [65000] for elasticsearch process is too low, increase to 
at least [65536]
[2017-10-16T13:54:23,382][WARN ][o.e.b.BootstrapChecks    ] [node-1] max 
number of threads [1024] for user [appadm01] is too low, increase to at 
least [2048]
[2017-10-16T13:54:23,382][WARN ][o.e.b.BootstrapChecks    ] [node-1] system 
call filters failed to install; check the logs and fix your configuration or 
disable system call filters at your own risk
我执行了sysctl-wfs.file max=65536,但得到了相同的结果。

你读了吗

它说:

在启动Elasticsearch之前,将ulimit-n 65536设置为root,或者在/etc/security/limits.conf中将nofile设置为65536。

试试这个:(从2-3个不同的来源获得)

加载项
$ES_HOME/config/elasticsearch.yml

network.host: 0.0.0.0
http.port: 9200
transport.host: localhost
transport.tcp.port: 9300
如果是本地开发人员设置,也可以使用较少的内存选项(如果可能):

$ES_HOME/config/jvm.options中添加/修改

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms512m
-Xmx512m

只需将/etc/security/limits.conf内容更新到下面

elasticsearch   soft    nofile          65536
elasticsearch   hard    nofile          65536
elasticsearch   memlock unlimited
并删除/etc/security/limits.d/nproc.conf的内容


不要忘记重新登录到shell以应用限制。

只需创建一个类似这样的systemd服务,密切关注ulimit nofile设置: vi/etc/systemd/system/elasticsearch.service:

[Unit]
Description=Spin ES Service
After=network.target

[Service]
User=<user name>
Group=<group name>
Type=simple
ExecStart=/bin/bash /home/<user>/elasticsearch-6.4.3/bin/elasticsearch
Restart=on-failure
RestartSec=5s
LimitAS=infinity
LimitRSS=infinity
LimitCORE=infinity
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
/etc/sysctl.conf

fs.file-max = 2097152
vm.max_map_count = 262144
vm.swappiness = 1
其次是:

sudo sysctl -p

对于那些使用docker运行弹性搜索的用户,您可以通过
docker run
命令设置ulimit,如下所示

docker run --ulimit nofile=65536:65536 -p 9200:9200 --name elastic-search docker.elastic.co/elasticsearch/elasticsearch:6.4.2

希望这将有助于docker用户

我在配置sonarqube时也遇到了同样的问题,并且能够通过在/etc/systemd/system/sonaQube.service文件中添加LimitNOFILE=65536参数来解决这个问题

[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=forking

ExecStart=/opt/sonarqube/sonarqube-7.9.1/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/sonarqube-7.9.1/bin/linux-x86-64/sonar.sh stop

User=sonarqube
Group=sonarqube
**LimitNOFILE=65536**
Restart=always

[Install]
WantedBy=multi-user.target

如果您运行SonarQube,本指南将有所帮助: 为我工作

如果要增加ulimit-n显示的限制,请修改以下文件

  • /etc/systemd/user.conf

  • /etc/systemd/system.conf

  • 在这两个文件中,另外添加以下行

      DefaultLimitNOFILE=65536
    
  • /etc/security/limits.conf,带有以下行

             *  soft    nofile  65536
             *  hard    nofile  65536
             elasticsearch   soft    nofile  65536
             elasticsearch   hard    nofile  65536
             elasticsearch   memlock unlimited
    

  • 我试过这个,它对我有用

    sudo sysctl -w vm.max_map_count=262144
    

    即使在更新ulimit之后,结果也是一样的<代码>elasticsearch进程的最大文件描述符[4096]太低,请至少增加到[65536]
    您可能需要注销并重新登录到runner用户的shell中,更改才能生效。可以通过执行
    ulimit-n
    进行验证。ES切换版本的速度太快,因此上述给定版本和文档的答案可能不匹配。它在低内存虚拟机/容器中特别存在。谢谢,这对我来说很有用,最初我只添加了“network.host:0.0.0”。在添加了上述所有内容后,它的工作没有任何问题。多谢。
    sudo sysctl -w vm.max_map_count=262144