redis设置开机自启详细
https://blog.csdn.net/qq_54796785/article/details/128757969
1.新建一个系统服务文件:
vi /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/opt/software/redis-6.2.6/src/redis-server /etc/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
备注
ExecStart=/opt/software/redis-6.2.6/src/redis-server :启动服务的命令的位置
/etc/redis.conf 配置文件命令的位置
2.重载系统服务
systemctl daemon-reload
现在就可以开启,关闭,查看状态了
# 启动
systemctl start redis
# 停止
systemctl stop redis
# 重启
systemctl restart redis
# 查看状态
systemctl status redis
3.设置开机自启动
systemctl enable redis
欢迎来撩 : 汇总all