CentOS7下redis服务

CentOS7下redis服务

# 新增redis服务配置文件
vim /etc/systemd/system/redis.service

写入配置

[Unit]
Description=Redis Server
After=network.target
After=syslog.target

[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/usr/local/redis/src/
LimitNOFILE=65535
ExecStart=/usr/local/redis/src/redis-server /usr/local/redis/redis.conf
ExecReload=/bin/kill -USR1 $MAINPID
Restart=always

[Install]
WantedBy=multi-user.target graphical.target

管理

# 启动
service redis start
# 停止
service redis stop
# 或
systemctl start redis.service
# 开机启动
systemctl enable redis.service

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注