redis开机自动启动

环境:

OS:Centos 7

添加redis开机自动启动
1.添加redis服务
vi /usr/lib/systemd/system/redis.service
文件内容如下:
[Unit]
Description=redis
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
Type=forking
User=root
Group=root
ExecStart=/usr/local/services/redis/bin/redis-server /home/middle/redis/conf/6589.conf
ExecReload=
ExecStop=/usr/local/services/redis/bin/redis-cli  -h 172.17.0.73 -a mypasswd -p 6589 shutdown
PrivateTmp=true

2.设置开机启动
chmod 754 /usr/lib/systemd/system/redis.service

systemctl enable redis.service
systemctl status redis.service
systemctl start redis.service
systemctl stop redis.service

posted @ 2019-09-25 08:59  slnngk  阅读(169)  评论(0编辑  收藏  举报