怎麼在同一台Linux的host運行多個 redis host呢?
centos 下
cp /etc/redis.conf /etc/redis-dev.conf
修改 /etc/redis-dev.conf
vim /etc/redis-dev.conf
修改部份
logfile "/var/log/redis/redis-dev.log"
dir "/var/lib/redis-dev"
pidfile "/var/run/redis/redis-dev.pid"
port 6380
建立資料夾
mkdir -p /var/lib/redis-dev
chown redis:redis /var/lib/redis-dev
因為使用 systemd
cp /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis-dev.service
修改 /usr/lib/systemd/system/redis-dev.service
[Service]
ExecStart=/usr/bin/redis-server /etc/redis-dev.conf --daemonize no
ExecStop=/usr/bin/redis-shutdown redis-dev
Enable redis-dev
systemctl enable redis-dev
啟動
service redis-dev start
看一下是否有正常啟動
lsof -i:6379
lsof -i:6380
# ps aux | grep redis
redis 6095 0.0 0.0 142912 2480 ? Ssl 18:37 0:10 /usr/bin/redis-server 127.0.0.1:6380
redis 28807 0.0 0.0 147008 6076 ? Ssl 15:15 0:20 /usr/bin/redis-server 127.0.0.1:6379
沒有留言:
張貼留言