背景
redis默认端口6379,由于开发需要,key有重复。于是另起端口6380。
配置服务过程
1、新建/etc/redis6380.conf,内容如下:
bind 0.0.0.0 port 6380 pidfile /var/run/redis_6380.pid logfile /var/log/redis/redis6380.log dbfilename dump6380.rdb dir /var/lib/redis #设置连接密码 requirepass xxxx
2、设置权限:
chmod -R 777 /var/log/redis/ chmod 777 /etc/redis6380.conf
3、设置服务
新建文件 /usr/lib/systemd/system/redis6380.service填入以下内容
[Unit] Description=Redis6380 persistent key-value database After=network.target After=network-online.target Wants=network-online.target [Service] ExecStart=/usr/bin/redis-server /etc/redis6380.conf --supervised systemd ExecStop=/usr/libexec/redis-shutdown redis6380 Type=notify User=redis Group=redis RuntimeDirectory=redis RuntimeDirectoryMode=0755 [Install] WantedBy=multi-user.target
4、设置为自动启动
systemctl enable redis6380.service
5、启动
systemctl start redis6380.service
一定执行第2步,要设置权限,否则报错
标签:target,redis,端口,开启,redis6380,var,6380 From: https://www.cnblogs.com/fgxwan/p/16911628.html