centOS7设置redis自启动
1, 查看centos版本
[ bin]# cat /etc/redhat-release CentOS Linux release 7.7.1908 (Core)
2, redis版本
[ bin]# redis-server -v Redis server v=6.0.1
3,新建redis.service服务文件
vim /usr/lib/systemd/system/redis.service
4,redis.service文件的内容
[Unit] Description=Redis Server Manager After=syslog.target network.target [Service] Type=forking PIDFile=/var/run/redis_6379.pid ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target
注意:ExecStart参数需要注意下,这里我的安装路径是"/usr/local/redis/bin",更改为各自的安装路径
5,刷新systemctl
systemctl daemon-reload
6,启动redis
systemctl start redis
7,设置redis开机自启动
systemctl enable redis
相关推荐
王道革 2020-11-25
wangdonghello 2020-11-03
Langeldep 2020-11-16
chenhualong0 2020-11-16
聚合室 2020-11-16
koushr 2020-11-12
MRFENGG 2020-11-11
guoyanga 2020-11-10
fackyou00 2020-11-10
Orangesss 2020-11-03
dongCSDN 2020-10-31
rainandtear 2020-10-30
Quietboy 2020-10-30
liuyulong 2020-10-29
fansili 2020-10-29
温攀峰 2020-10-23
jackbon 2020-10-19
kaixinfelix 2020-10-04