redis开机自启脚本

vi /etc/systemd/system/redis.service

Unit

Description=Redis persistent key-value database

After=network.target

After=network-online.target

Wants=network-online.target

Service

如果 redis.conf 中 daemonize 为 yes,则 Type 为 forking

如果 daemonize 为 no,则 Type 为 simple,且不需要 PIDFile

Type=simple

ExecStart=/opt/redis-8.0.0/bin/redis-server /opt/redis-8.0.0/redis.conf

ExecStop=/opt/redis-8.0.0/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown

Restart=always

PIDFile=/var/run/redis_6379.pid

TimeoutStopSec=0

Install

WantedBy=multi-user.target

systemctl daemon-reload

systemctl enable redis

systemctl start redis

systemctl status redis

相关推荐
codeejun13 小时前
每日一Go·MySQL-17、分页优化方案
数据库·mysql
CoderYanger13 小时前
Java EE 进阶:9.MyBatis 操作数据库(进阶)(第四弹):图书管理系统(用户登录+添加图书)
java·数据库·spring boot·mysql·面试·java-ee·mybatis
Decay__13 小时前
附 - 02・SQLServer 分库分表与中间件 —— 原生分区表、横向分库实践与联邦查询
运维·数据库·sql·mysql·架构
牧瀬クリスだ13 小时前
从零手写博客系统:分层架构与统一响应(一)
java·数据库·架构·mybatis·springboot·安全架构
the局外人13 小时前
Python 实战检索优化:BM25、向量与重排
数据库·后端·python
得物技术14 小时前
从研发经验到团队知识:Akashic知识工程实践|得物技术
数据库·程序员·架构
ClouGence14 小时前
开源数据库管理工具 CloudDM 发布新版本,支持 GreptimeDB 数据源
数据库·kafka
wno70415 小时前
Centos下PostgreSQL安装部署详细步骤
java·数据库·spring boot
文丑颜不良啊15 小时前
InnoDB 和 MyISAM
数据库
ShineWinsu16 小时前
对于Qt:QVBoxLayout常见属性以及方法的解析
开发语言·数据库·c++·qt·gui·客户端·布局管理器