Linux 添加redis守护进程

1、编写启动服务文件 /lib/systemd/system/redis.service

[Unit]
Description=The redis-server Process Manager
Documentation=https://redis.io/
After=network.target

[Service]
Type=forking

#根据自己的redis路径启动和停止
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf
ExecStop=/usr/local/redis/bin/redis-cli shutdown

[Install]
WantedBy=multi-user.target

 

2、添加开机启动

systemctl daemon-reload
systemctl enable redis

posted @ 2023-06-01 09:54  leihongnu  阅读(188)  评论(0编辑  收藏  举报