From c049b75b64e5f0ee6188bc2c711a74a900c958f5 Mon Sep 17 00:00:00 2001 From: nadoo <287492+nadoo@users.noreply.github.com> Date: Thu, 2 Aug 2018 13:16:05 +0800 Subject: [PATCH] systemd: add introduction for systemd file open limit --- systemd/README.md | 53 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/systemd/README.md b/systemd/README.md index 2b2df3d..cd5fd61 100644 --- a/systemd/README.md +++ b/systemd/README.md @@ -1,27 +1,72 @@ ## Service -binary file: +### Install + +#### 1. copy binary file + ```bash cp glider /usr/bin/ ``` -service file: +#### 2. add service file + ```bash # copy service file to systemd cp systemd/glider@.service /etc/systemd/system/ ``` -config file: ***server***.conf +#### 3. add config file: ***server***.conf + ```bash # copy config file to /etc/glider/ mkdir /etc/glider/ cp ./config/glider.conf.example /etc/glider/server.conf ``` -enable and start service: glider@***server*** +#### 4. enable and start service: glider@***server*** + ```bash # enable and start service systemctl enable glider@server systemctl start glider@server ``` + See [glider@.service](glider%40.service) + +### Open file limit + +#### 1. setup system limit + +vim /etc/security/limits.d/unlimited.conf + +```bash +* soft nofile unlimited +* hard nofile unlimited +* soft nproc unlimited +* hard nproc unlimited +``` + +#### 2. change **systemd** limit + +```bash +echo DefaultLimitNOFILE=102400 >> /etc/systemd/system.conf +echo DefaultLimitNOFILE=102400 >> /etc/systemd/user.conf +``` + +#### 3. reexec **systemd** + +```bash +systemctl daemon-reexec +``` + +#### 4. restart glider service + +```bash +systemctl restart glider@server +``` + +#### 5. check the limits of PID + +```bash +cat /proc/PID/limits +```