CentOS中如何将Redis配置为系统服务
小编给大家分享一下CentOS中如何将Redis配置为系统服务,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
CentOS 将 Redis 配置为系统服务
创建 redis.service
cd /usr/lib/systemd/systemtouch redis.service
编辑内容
[Unit]Description=Redis ServerAfter=network.target[Service]PIDFile=/var/run/redis_6379.pidExecStart=/usr/local/bin/redis-server /etc/redis.confExecStop=/usr/local/bin/redis-cli -a passwd shutdownExecReload=/bin/kill -s HUP $MAINPID[Install]WantedBy=mutli-user.target
重新载入 systemctl 并启动服务
systemctl daemon-reloadsystemctl start redis.service
查看状态
systemctl status redis.service
关闭 Redis
systemctl stop redis.service
开机自启
systemctl enable redis.service
是否开机自启
systemctl is-enabled redis.service
以上是CentOS中如何将Redis配置为系统服务的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。