首页 > 其他 > 详细

redis多实例

时间:2020-08-06 21:48:33      阅读:126      评论:0      收藏:0      [点我收藏+]

1.创建多实例目录

[root@db01 ~]# mkdir /service/redis/{6380,6381}

2.配置多实例配置文件

#第一台多实例配置
[root@db01 ~]# vim /service/redis/6379/redis.conf 
bind 172.16.1.51 127.0.0.1
port 6379
daemonize yes
pidfile /service/redis/6379/redis_6379.pid
loglevel notice
logfile /service/redis/6379/redis_6379.log
dir /service/redis/6379
dbfilename dump.rdb
save 900 1
save 300 10
save 60 10000

#第二台多实例配置
[root@db01 ~]# vim /service/redis/6380/redis.conf 
bind 172.16.1.51 127.0.0.1
port 6380
daemonize yes
pidfile /service/redis/6380/redis_6380.pid
loglevel notice
logfile /service/redis/6380/redis_6380.log
dir /service/redis/6380
dbfilename dump.rdb
save 900 1
save 300 10
save 60 10000

#第三台多实例配置
[root@db01 ~]# vim /service/redis/6381/redis.conf 
bind 172.16.1.51 127.0.0.1
port 6381
daemonize yes
pidfile /service/redis/6381/redis_6381.pid
loglevel notice
logfile /service/redis/6381/redis_6381.log
dir /service/redis/6381
dbfilename dump.rdb
save 900 1
save 300 10
save 60 10000

3.启动多实例

[root@db01 ~]# redis-server /service/redis/6379/redis.conf 
[root@db01 ~]# redis-server /service/redis/6380/redis.conf 
[root@db01 ~]# redis-server /service/redis/6381/redis.conf

4.检测启动

[root@db01 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      14002/redis-server  
tcp        0      0 172.16.1.51:6379        0.0.0.0:*               LISTEN      14002/redis-server  
tcp        0      0 127.0.0.1:6380          0.0.0.0:*               LISTEN      15541/redis-server  
tcp        0      0 172.16.1.51:6380        0.0.0.0:*               LISTEN      15541/redis-server  
tcp        0      0 127.0.0.1:6381          0.0.0.0:*               LISTEN      15545/redis-server  
tcp        0      0 172.16.1.51:6381        0.0.0.0:*               LISTEN      15545/redis-server   

[root@db01 ~]# ps -ef | grep redis
root      14002      1  0 Aug04 ?        00:01:34 redis-server 172.16.1.51:6379
root      15541      1  0 11:50 ?        00:00:00 redis-server 172.16.1.51:6380
root      15545      1  0 11:50 ?        00:00:00 redis-server 172.16.1.51:6381

5.连接多实例

[root@db01 ~]# redis-cli -p 6379
127.0.0.1:6379> quit

[root@db01 ~]# redis-cli -p 6380
127.0.0.1:6380> quit

[root@db01 ~]# redis-cli -p 6381
127.0.0.1:6381> quit

redis多实例

原文:https://www.cnblogs.com/Applogize/p/13449106.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!