systemd: add introduction for systemd file open limit

This commit is contained in:
nadoo 2018-08-02 13:16:05 +08:00
parent 73a778f5e1
commit c049b75b64

View File

@ -1,27 +1,72 @@
## Service ## Service
binary file: ### Install
#### 1. copy binary file
```bash ```bash
cp glider /usr/bin/ cp glider /usr/bin/
``` ```
service file: #### 2. add service file
```bash ```bash
# copy service file to systemd # copy service file to systemd
cp systemd/glider@.service /etc/systemd/system/ cp systemd/glider@.service /etc/systemd/system/
``` ```
config file: ***server***.conf #### 3. add config file: ***server***.conf
```bash ```bash
# copy config file to /etc/glider/ # copy config file to /etc/glider/
mkdir /etc/glider/ mkdir /etc/glider/
cp ./config/glider.conf.example /etc/glider/server.conf cp ./config/glider.conf.example /etc/glider/server.conf
``` ```
enable and start service: glider@***server*** #### 4. enable and start service: glider@***server***
```bash ```bash
# enable and start service # enable and start service
systemctl enable glider@server systemctl enable glider@server
systemctl start glider@server systemctl start glider@server
``` ```
See [glider@.service](glider%40.service) 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
```