redis配置systemctl


vim /lib/systemd/system/redis.service

[Unit]
Description=redis
After=network.target

[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/src/redis-server /usr/local/redis/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

注意,路径替换成你自己的安装路径, pid路径和 redis.conf里面的路径保持一致
systemctl daemon-reload //刚刚配置的服务需要让systemctl能识别,就必须刷新配置
systemctl enable redis.service //加入开机启动


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM