1.编辑systemctl服务配置文件
vim /lib/systemd/system/redis.service
2.内容如下
[Unit]
Description=Redis
After=network.target
[Service]
Type=forking
PIDFile=/var/run/redis_6310.pid
ExecStart=/data/app/redis/src/redis-server /data/app/redis/config/redis6310.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3.重载系统服务
systemctl daemon-reload
4.启动redis
systemctl start redis
systemctl status redis
5.设置开机启动
systemctl enable redis