美文网首页
CentOS将Redis配置为系统服务的方法

CentOS将Redis配置为系统服务的方法

作者: 也许会了 | 来源:发表于2020-10-26 16:15 被阅读0次

CentOS 将 Redis 配置为系统服务

创建 redis.service

cd  /usr/lib/systemd/system

touch redis.service

编辑内容

[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 并启动服务

systemctl daemon-reload

systemctl start redis.service

查看状态

systemctl status redis.service

关闭 Redis

systemctl stop redis.service

开机自启

systemctl enable redis.service

是否开机自启

systemctl is-enabled redis.service

本文来自PHP中文网的centos教程栏目:https://www.php.cn/centos/

相关文章

网友评论

      本文标题:CentOS将Redis配置为系统服务的方法

      本文链接:https://www.haomeiwen.com/subject/uinamktx.html