linux 开机自启动redis服务
程序员文章站
2022-12-18 13:52:00
[Unit] Description=The redis-server Process Manager Documentation=https://redis.io/ After=network.target [Service] Type=forking ExecStart=/root/redis- ......
[unit] description=the redis-server process manager documentation=https://redis.io/ after=network.target [service] type=forking execstart=/root/redis-5.0.7/src/redis-server /root/redis-5.0.7/redis.conf
#有密码则需要在cli后面加 -a "密码" execstop=/root/redis-5.0.7/src/redis-cli shutdown [install] wantedby=multi-user.target
1.先输入
vi /lib/systemd/system/redis.service
把上述配置复制进去,保存退出
2.设置开机自启动
systemctl enable redis
3.使用命令
#开启服务 systemctl start redis #停止服务 systemctl stop redis #查看运行状态 system status redis