redis set from the start

redis set from the start

repeat

1, create a service (redis.conf profile to note that, after cp produced a number of redis.conf)

vim /lib/systemd/system/redis.service

[Unit]

Description=Redis
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf 
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

Note the file name and directory mode

[The Install]
WantedBy = multi-user.target
copy the code
[the Install]
WantedBy = multi-user.target
[Unit] indicates that this is the basis of the information
Description describing
After that service is to start at the back, usually start after the network service starts
[Service ] is represented here is the command to start the service information ExecStart services
ExecStop is an instruction to stop services
[install] indicates that this is the installation information WantedBy is which way to start:
multi-user.target indicate when the system is in multiuser mode (the default when the run level) start, the service needs to be run automatically.

2, refresh configuration

Just need to configure the service to identify systemctl, you must refresh the configuration
when systemctl daemon-

3, 3 test configuration, start, restart, stop

启动redis
systemctl start redis
systemctl restart redis
systemctl stop redis

4, set the boot from the start

redis added service startup
systemctl enable redis
prohibit boot
systemctl disable redis

5, view the status

systemctl status redis

Guess you like

Origin www.cnblogs.com/programer-xinmu78/p/11616210.html