Add systemd ulimit override function and set an override for NOFILE

This sets our default ulimit NOFILE to 2048, which is double what we
set things like mysql'd max_connections to.

Change-Id: I5126bed1e6b9f8c64db00eae4151ac61e47b1bf8
This commit is contained in:
Dan Smith 2017-05-16 08:50:53 -07:00
parent ac042d4122
commit 1f55d38911
3 changed files with 22 additions and 0 deletions

View File

@ -720,6 +720,22 @@ function enable_kernel_bridge_firewall {
}
# Set a systemd system override
#
# This sets a system-side override in system.conf. A per-service
# override would be /etc/systemd/system/${service}.service/override.conf
function set_systemd_override {
local key="$1"
local value="$2"
local sysconf="/etc/systemd/system.conf"
iniset -sudo "${sysconf}" "Manager" "$key" "$value"
echo "Set systemd system override for ${key}=${value}"
sudo systemctl daemon-reload
}
# Restore xtrace
$_XTRACE_FUNCTIONS

View File

@ -765,6 +765,9 @@ install_infra
# Phase: pre-install
run_phase stack pre-install
# NOTE(danms): Set global limits before installing anything
set_systemd_override DefaultLimitNOFILE ${ULIMIT_NOFILE}
install_rpc_backend
restart_rpc_backend

View File

@ -925,6 +925,9 @@ fi
# ``LOGDIR`` is always set at this point so it is not useful as a 'enable' for service logs
# ``SCREEN_LOGDIR`` may be set, it is useful to enable the compat symlinks
# System-wide ulimit file descriptors override
ULIMIT_NOFILE=${ULIMIT_NOFILE:-2048}
# Local variables:
# mode: shell-script
# End: