小編給大家分享一下CentOS中如何將Redis配置為系統(tǒng)服務(wù),相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
CentOS 將 Redis 配置為系統(tǒng)服務(wù)
創(chuàng)建 redis.service
cd /usr/lib/systemd/system touch redis.service
編輯內(nèi)容
[Unit] Description=Redis Server After=network.target [Service] PIDFile=/var/run/redis_6379.pid ExecStart=/usr/local/bin/redis-server /etc/redis.conf ExecStop=/usr/local/bin/redis-cli -a passwd shutdown ExecReload=/bin/kill -s HUP $MAINPID [Install] WantedBy=mutli-user.target
重新載入 systemctl 并啟動服務(wù)
systemctl daemon-reload systemctl start redis.service
查看狀態(tài)
systemctl status redis.service
關(guān)閉 Redis
systemctl stop redis.service
開機(jī)自啟
systemctl enable redis.service
是否開機(jī)自啟
systemctl is-enabled redis.service
以上是CentOS中如何將Redis配置為系統(tǒng)服務(wù)的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!