假設我們服務器上面已經安裝好了redis;
可參看:http://zlyang.blog.51cto.com/1196234/1834700
下面我們來配置redis單主機多實例:
我們首先拷貝兩份文件:
[root@infa redis-2.8.12]# cp /etc/redis.conf /etc/redis6380.conf
[root@infa redis-2.8.12]# cp /etc/redis.conf /etc/redis6381.conf
一、配置6380端口
[root@infa ~]# vim /etc/redis6380.conf
[root@infa redis-2.8.12]# src/redis-server /etc/redis6380.conf
可以看到6380端口已經啓動起來
登錄6380端口:
二、同理我們配置6381端口:
[root@infa redis-2.8.12]# src/redis-server /etc/redis6381.conf
可以看到6381端口也已經啓動起來
登錄6381端口
查看進程:
二、配置主從:
修改從庫配置:
[root@infa redis-2.8.12]# vim /etc/redis6380.conf
[root@infa redis-2.8.12]# vim /etc/redis6381.conf
主庫
從庫:
可以看到主從數據實現同步;