暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

CentOS 将 Redis 配置为系统服务

51reboot运维开发 2018-08-16
395


创建 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


创建软链接

ln -s `pwd`/redis.service /etc/systemd/system/multi-user.target.wants


重新载入 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


作者:Castle

原文链接:https://www.gonever.com/post/81



点击下面的连接,查看历史文章
神器 Tmux 的超绝便利
Django—— restful设计风格
Django——发送邮件和缓存
Django —— 验证码,中间件
Python: Windows下用 multiprocessing 的深坑
Python: C扩展初体验
Python 中读取和保存图像方法汇总及其区别

......

文章转载自51reboot运维开发,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论