Redis使用命令启动怎么设置systemctl管理
- 设置配置文件
填写完整的启动命令
使用绝对路径
# cat /usr/lib/systemd/system/redis.service
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
ExecStart=/home/redis-5.0.10/src/redis-server /home/redis-5.0.10/redis.conf
ExecStop=/home/redis-5.0.10/src/redis-cli shutdown
Restart=always
User=root
Group=root
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
- 设置开肩自启动
# systemctl daemon-reload
# systemctl enable redis
# systemctl start redis