Redis单机多实例配置

2016-12-28 15:18:00
u6751u91ccu6765u7684u626bu5730u50e7
原创
1133
1,创建存放多实例目录6380
[root@linux-02 /]# mkdir -p /data/6380/

2,复制redis.conf文件到/data/6380/目录下
[root@linux-02 /]# cp /redis/redis-conf  /data/6380/

3,编辑/data/6380/下redis.conf文件
[root@linux-02 6380]# vim redis.conf 

修改84行端口
84 port 6380

修改150行PID文件:
150 pidfile /data/6380/redis_6380.pid

修改593行
593 appendonly yes

修改480行密码:
480  requirepass password123@

4,启动多实例6380
[root@linux-02 6380]# redis-server /data/6380/redis.conf 
[root@linux-02 6380]# redis-cli -p 6380 -a password123@
127.0.0.1:6380> 
127.0.0.1:6380> KEYS *
1) "key"

5,显示进程情况

[root@linux-02 ~]# lsof -i :6379
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
redis-ser 3562 root    4u  IPv4  14229      0t0  TCP localhost:6379 (LISTEN)
redis-ser 3562 root    5u  IPv4  14794      0t0  TCP localhost:6379->localhost:39206 (ESTABLISHED)
redis-cli 3624 root    3u  IPv4  14793      0t0  TCP localhost:39206->localhost:6379 (ESTABLISHED)
[root@linux-02 ~]# lsof -i :6380
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
redis-ser 3846 root    4u  IPv4  15748      0t0  TCP localhost:6380 (LISTEN)
redis-ser 3846 root    6u  IPv4  15756      0t0  TCP localhost:6380->localhost:35350 (ESTABLISHED)
redis-cli 3849 root    3u  IPv4  15755      0t0  TCP localhost:35350->localhost:6380 (ESTABLISHED)
[root@linux-02 ~]# 
发表评论
零 加 伍 =
评论通过审核后显示。