在centos7下面使用systemctl启动redis
1,找到服务加载文件地址:
/usr/lib/systemd/system
2,如果没有redis.server文件则创建一个:
vim redis.server
内容如下:
[Unit]
Description=Redis persistent key-value database
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/redis-server /etc/redis.conf
ExecStop=/usr/libexec/redis-shutdown
#Type=notify
#User=redis
#Group=redis
#RuntimeDirectory=redis
#RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
3,重新加载
systemctl daemon-reload
4,启动
设置Redis服务开机启动
systemctl enable redis
启动Redis服务
systemctl start redis
停止Redis服务
systemctl stop redis
查看状态
systemctl status redis
网友评论