tesila

一、环境

centos7.6

redis-6.2.5

二、步骤

1、在 /lib/systemd/system 目录添加 nginx.service 文件

#进入自启文件目录
cd /lib/systemd/system 
#自定义nginx自启文件
touch redis.service

2、编辑redis.service

添加一下内容

[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server   /usr/local/redis/etc/redis.conf
ExecStop=/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown
PrivateTmp=true
Restart=always


[Install]
WantedBy=multi-user.target

3、设置开机自启

# 设置开机启动
systemctl enable redis.service

4、其他命令

#启动redis
systemctl start redis
#重启redis
systemctl restart redis
#停止redis
systemctl stop redis
#查看redis状态
systemctl status redis

 

分类:

技术点:

相关文章:

  • 2021-12-09
  • 2021-12-09
  • 2021-09-24
  • 2021-10-05
  • 2021-11-20
  • 2021-12-03
  • 2017-11-24
  • 2021-12-14
猜你喜欢
  • 2021-04-05
  • 2021-12-10
  • 2021-08-11
  • 2019-09-23
  • 2021-09-24
  • 2021-11-30
  • 2021-04-22
相关资源
相似解决方案