centos7里Redis 开机自启

nano /usr/lib/systemd/system/redis.service

[Unit]
Description=Redis
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/var/run/redis.pid
ExecStart=/home/linbin/software/redis-5.0.2/src/redis-server
ExecStop=/bin/kill -SIGINT $MAINPID
ExecReload=/bin/kill -USR2 $MAINPID
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

----
ln -s /usr/lib/systemd/system/redis.service /etc/systemd/system/multi-user.target.wants/redis.service
systemctl daemon-reload
systemctl enable redis

------
systemctl disable redis
systemctl start redis
systemctl stop redis
systemctl status redis
 

你可能感兴趣的:(spring,cloud,hadoop,java,redis)