linux 开机自启动redis服务

[Unit]Description=The redis-server Process ManagerDocumentation=https://redis.io/After=network.target[Service]Type=forkingExecStart=/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
(0)

相关推荐