[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.先輸入redis
vi /lib/systemd/system/redis.service
把上述配置複製進去,保存退出spa
2.設置開機自啓動code
systemctl enable redis
3.使用命令server
#開啓服務 systemctl start redis #中止服務 systemctl stop redis #查看運行狀態 system status redis