Centos7下使用systemd管理redis服務啓動

systemctl管理Redis

 

背景

      直接編譯安裝的redis沒有直接service管理,試試使用systemctl管理吧。

1.編輯服務文件

vim /usr/lib/systemd/system/redis.service
[Unit]

Description=Redis persistent key-value database

After=network.target

[Service]

ExecStart=/home/data/redis/bin/redis-server /home/data/redis/etc/redis.conf --supervised systemd

ExecStop=/bin/kill -s QUIT $MAINPID

Type=notify

User=redis

Group=redis

RuntimeDirectory=redis

RuntimeDirectoryMode=0755

[Install]

WantedBy=multi-user.target

2.加載服務,啓動

systemctl daemon-reload
systemctl enable redis
systemctl start redis 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章