Redis开机自启
添加开机启动服务
vi /etc/systemd/system/redis.service
在redis.service中输入以下内容
ps:ExecStart配置成自己的路径
[Unit] Description=redis-server After=network.target [Service] Type=forking ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf PrivateTmp=true [Install] WantedBy=multi-user.target
设置开机启动
systemctl daemon-reload
systemctl start redis.service
systemctl enable redis.service
redis服务操作命令
systemctl start redis.service #启动redis服务 systemctl stop redis.service #停止redis服务 systemctl restart redis.service #重新启动服务 systemctl status redis.service #查看服务当前状态 systemctl enable redis.service #设置开机自启动 systemctl disable redis.service #停止开机自启动