I am trying to set the max open files on CentOS 7 for elasticsearch. I've read over and over again how to set this but it doesn't seem to be working. As I understand it:
- limits.conf is irrelevant because elasticsearch user is set to /sbin/nologin and we're starting the daemon with system
- I need to set
LimitNOFILE=65535in the systemd unit file.
So, I went ahead and did that, here's my unit file, it's provided by the elasticsearch puppet module:
[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 Note how limitNOFILE is set here. I have also set MAX_OPEN_FILES in my EnvironmentFile:
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 However, elasticsearch still reports that the max open files are 4096, both from within the app itself, and from with /proc/<pid>/limits
Does anyone know what I'm doing wrong here? I even tried setting this from within limits.conf but as I expected, no luck.
sestatus SELinux status: disabled