我正在尝试在CentOS 7上设置弹性search的最大打开文件。 我一遍又一遍地阅读如何设置,但它似乎并没有工作。 据我所知:
LimitNOFILE=65535 。 所以,我继续做下去,这是我的单元文件,它由elasticsearch puppet模块提供 :
[Unit] Description=Starts and stops a single elasticsearch instance on this system Documentation=http://www.elasticsearch.org [Service] Type=forking EnvironmentFile=/etc/sysconfig/elasticsearch-graylog2 User=elasticsearch Group=elasticsearch PIDFile=/var/run/elasticsearch/elasticsearch-graylog2.pid ExecStart=/usr/share/elasticsearch/bin/elasticsearch -d -p /var/run/elasticsearch/elasticsearch-graylog2.pid -Des.default.path.home=${ES_HOME} -Des.default.path.logs=${LOG_DIR} -Des.default.path.data=${DATA_DIR} -Des.default.path.work=${WORK_DIR} -Des.default.path.conf=${CONF_DIR} # See MAX_OPEN_FILES in sysconfig LimitNOFILE=65535 # See MAX_LOCKED_MEMORY in sysconfig, use "infinity" when MAX_LOCKED_MEMORY=unlimited and using bootstrap.mlockall: true # Shutdown delay in seconds, before process is tried to be killed with KILL (if configured) TimeoutStopSec=20 [Install] WantedBy=multi-user.target
注意limitNOFILE是如何在这里设置的。 我也在我的EnvironmentFile中设置了MAX_OPEN_FILES:
CONF_DIR=/etc/elasticsearch/graylog2 CONF_FILE=/etc/elasticsearch/graylog2/elasticsearch.yml ES_GROUP=elasticsearch ES_HOME=/usr/share/elasticsearch ES_USER=elasticsearch LOG_DIR=/var/log/elasticsearch/graylog2 MAX_OPEN_FILES=65535
然而,elasticsearch仍然报告最大打开的文件是4096,无论是从应用程序本身,并从/proc/<pid>/limits
有谁知道我在这里做错了吗? 我甚至尝试从limits.conf设置这个,但是正如我所料,没有运气。
用户不能设置为/ sbin / nologin,这是它的shell的path。 所以你需要调整你的limits.conf