21.21 redis主從配置 node
21.22 redis集羣介紹 mysql
21.23-24 redis集羣搭建配置linux
21.25 redis集羣操做git
21.21 redis主從配置github
1 爲了節省資源,咱們能夠在一臺機器上啓動兩個redis服務redis
cp /etc/redis.conf /etc/redis2.conf
vim /etc/redis2.conf port 6380 dir /data/redis2 pidfile /var/run/redis_6380.pid logfile "/var/log/redis2.log" #每一個文件都須要修改port,dir,pidfile,logfile #還要增長一行 # slaveof <masterip> <masterport> 參考格式 slaveof 127.0.0.1 6379
若是主上設置了密碼,還須要增長記錄設置主的密碼:sql
參考:# masterauth <master-password>vim
格式:masterauth 密碼centos
啓動以前不要忘記建立新的dir目錄ruby
mkdir /data/redis2
2 啓動從,6380端口啓動
redis-server /etc/redis2.conf redis-cli -h 127.0.0.1 -p 6380 127.0.0.1:6380>
3 測試:在主上建立新的key,在從上查看
127.0.0.1:6380> keys * 1) "set1" 2) "PHPREDIS_SESSION:url4j8mtr8j0m0ql874552tem7" 3) "key1" 4) "list11" 5) "hash1" 6) "PHPREDIS_SESSION:thrfeuq728o51vpucnl0nrjnt1" 7) "set2" 8) "zseta" 9) "PHPREDIS_SESSION:lu4uq50i27qcd8ne81t8jpsbc1" 10) "key10" 11) "key3" 12) "key2" 13) "seta" 14) "list1" 15) "set3" 16) "PHPREDIS_SESSION:ks5pdipag3gqlmh1rulobps8b3" 17) "PHPREDIS_SESSION:psugne742rjjsi82maqu7urrv2" 18) "PHPREDIS_SESSION:5oni0crm9bc38jcju2o9qjb4o5"
一樣,返回到主(6379)查看keys,是同樣的數據
127.0.0.1:6379> keys * 1) "PHPREDIS_SESSION:thrfeuq728o51vpucnl0nrjnt1" 2) "key1" 3) "PHPREDIS_SESSION:ks5pdipag3gqlmh1rulobps8b3" 4) "key2" 5) "list1" 6) "PHPREDIS_SESSION:lu4uq50i27qcd8ne81t8jpsbc1" 7) "set3" 8) "PHPREDIS_SESSION:5oni0crm9bc38jcju2o9qjb4o5" 9) "list11" 10) "set1" 11) "zseta" 12) "PHPREDIS_SESSION:psugne742rjjsi82maqu7urrv2" 13) "hash1" 14) "seta" 15) "PHPREDIS_SESSION:url4j8mtr8j0m0ql874552tem7" 16) "key10" 17) "key3" 18) "set2"
注意:
redis主從和mysql主從不同,redis主從不用事先同步數據,它會自動同步過去
默認,從是不能進行寫的動做,由於設定了只讀參數
redis2.conf中的 slave-read-only yes
若是要改爲可寫,把yes改爲no便可
21.22 redis集羣介紹
多個redis節點網絡互聯,數據共享
全部的節點都是一主一從(能夠是多個從),其中從不提供服務,僅做爲備用
不支持同時處理多個鍵(如mset/mget),由於redis須要把鍵均勻分佈在各個節點上,併發量很高的狀況下同時建立鍵值會下降性能並致使不可預測的行爲。
支持在線增長、刪除節點
客戶端能夠連任何一個主節點進行讀寫
22.23 Redis集羣搭建配置(上)
場景設置:
兩臺機器A(192.88.29.250) ,B(192.88.29.200)
兩臺機器,分別開啓三個Redis服務(端口)
兩臺機器上都要編譯安裝redis,而後編輯並複製3個不一樣的redis.conf,分別設置不一樣的端口號、dir等參數,還須要增長cluster相關參數,而後分別啓動6個redis服務
操做設置:
1 A機器上三個端口7000,7002,7004,所有爲主
編輯redis_7000.conf,加入以下參數:
vim redis_7000.conf port 7000 bind 192.88.29.250 daemonize yes pidfile /var/run/redis_7000.pid dir /data/redis_data/7000 cluster-enabled yes cluster-config-file nodes_7000.conf cluster-node-timeout 10100 appendonly yes
2 因爲7002,7004的配置都差很少,只是端口號和pid等等發生對應變化,其餘不變,因此將其複製7000的配置文件,而後修改對應參數便可。
複製配置對應文件
cp redis_7000.conf redis_7002.conf cp redis_7002.conf redis_7004.conf
修改相關參數,此處將7000分別改爲7002和7004便可
sed -i 's/7000/7002/g' redis_7002.conf sed -i 's/7000/7004/g' redis_7004.conf
3 檢查是否修改正確
# cat redis_7002.conf port 7002 bind 192.88.29.250 daemonize yes pidfile /var/run/redis_7002.pid dir /data/redis_data/7002 cluster-enabled yes cluster-config-file nodes_7002.conf cluster-node-timeout 10100 appendonly yes
——————————————————————
# cat redis_7004.conf port 7004 bind 192.88.29.250 daemonize yes pidfile /var/run/redis_7004.pid dir /data/redis_data/7004 cluster-enabled yes cluster-config-file nodes_7004.conf cluster-node-timeout 10100 appendonly yes
4 B機器上三個端口7001,7003,7005,所有爲從
加入B機器上面沒有安裝redis,能夠從A機器上scp過來,而後再進去redis的源碼包make && make install便可
方法跟A機器操做差很少,配置文件也是,只是B機器須要更改一下bind 的ip:192.88.29.200
5 確保已關閉防火牆(iptables,selinux)
A機器
[root@9F-VM1 etc]# iptables -nvL Chain INPUT (policy ACCEPT 2309K packets, 148M bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1795K packets, 176M bytes) pkts bytes target prot opt in out source destination [root@9F-VM1 etc]# getenforce Disabled
B機器
[root@9F-VM2 redis-4.0.1]# iptables -nvL Chain INPUT (policy ACCEPT 2286K packets, 209M bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1858K packets, 108M bytes) pkts bytes target prot opt in out source destination [root@9F-VM2 redis-4.0.1]# getenforce Disabled
6 啓動redis
6.1 建立/data/reids各端口目錄
A: mkdir /data/redis_data/{7000,7002,7004} B: mkdir /data/redis_data/{7001,7003,7005}
6.2啓動redis
A機器
[root@9F-VM1 etc]# redis-server /etc/redis_7000.conf 14543:C 27 Aug 17:07:36.458 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 14543:C 27 Aug 17:07:36.458 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=14543, just started 14543:C 27 Aug 17:07:36.459 # Configuration loaded [root@9F-VM1 etc]# redis-server /etc/redis_7002.conf 14552:C 27 Aug 17:07:41.539 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 14552:C 27 Aug 17:07:41.540 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=14552, just started 14552:C 27 Aug 17:07:41.540 # Configuration loaded [root@9F-VM1 etc]# redis-server /etc/redis_7004.conf 14557:C 27 Aug 17:07:44.212 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 14557:C 27 Aug 17:07:44.212 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=14557, just started 14557:C 27 Aug 17:07:44.212 # Configuration loaded
B機器
[root@9F-VM2 etc]# redis-server /etc/redis_7001.conf 46960:C 27 Aug 17:08:51.600 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 46960:C 27 Aug 17:08:51.600 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=46960, just started 46960:C 27 Aug 17:08:51.600 # Configuration loaded [root@9F-VM2 etc]# redis-server /etc/redis_7003.conf 46965:C 27 Aug 17:08:56.567 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 46965:C 27 Aug 17:08:56.567 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=46965, just started 46965:C 27 Aug 17:08:56.567 # Configuration loaded [root@9F-VM2 etc]# redis-server /etc/redis_7005.conf 46970:C 27 Aug 17:08:58.543 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 46970:C 27 Aug 17:08:58.543 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=46970, just started 46970:C 27 Aug 17:08:58.543 # Configuration loaded
21.24 Redis集羣搭建配置(下)
#安裝ruby2.2 (只須要一臺機器上運行) yum -y groupinstall "Development Tools" yum -y install gdbm-devel libdb4-devel libffi-devel libyaml libyaml-devel ncurses-devel openssl-devel readline-devel tcl-devel cd /root/ mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.gz -P rpmbuild/SOURCES wget https://raw.githubusercontent.com/tjinjin/automate-ruby-rpm/master/ruby22x.spec -P rpmbuild/SPECS rpmbuild -bb rpmbuild/SPECS/ruby22x.spec yum -y localinstall rpmbuild/RPMS/x86_64/ruby-2.2.3-1.el7.centos.x86_64.rpm gem install redis cp /usr/local/src/redis-4.0.1/src/redis-trib.rb /usr/bin/ redis-trib.rb create --replicas 1 192.88.29.250:7000 192.88.29.250:7002 192.88.29.250:7004 192.88.29.200:7001 192.88.29.200:7003 192.88.29.200:7005 #建立redis cluster # redis-trib.rb create --replicas 1 192.88.29.250:7000 192.88.29.250:7002 192.88.29.250:7004 192.88.29.200:7001 192.88.29.200:7003 192.88.29.200:7005 >>> Creating cluster >>> Performing hash slots allocation on 6 nodes... Using 3 masters: 192.88.29.250:7000 192.88.29.200:7001 192.88.29.250:7002 Adding replica 192.88.29.200:7003 to 192.88.29.250:7000 Adding replica 192.88.29.250:7004 to 192.88.29.200:7001 Adding replica 192.88.29.200:7005 to 192.88.29.250:7002 M: fd815645707134eb8b83a0e7514ab9024ed7b6da 192.88.29.250:7000 slots:0-5460 (5461 slots) master M: eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002 slots:10923-16383 (5461 slots) master S: fa1d015f3f72fe7b0d8ec9c54dd3e8b874009725 192.88.29.250:7004 replicates aaea373f41c98067e7783e452cecd9d9d145a273 M: aaea373f41c98067e7783e452cecd9d9d145a273 192.88.29.200:7001 slots:5461-10922 (5462 slots) master S: cad78846d6e8d3a47c3adeee2409b1433207b559 192.88.29.200:7003 replicates fd815645707134eb8b83a0e7514ab9024ed7b6da S: b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005 replicates eafad428987282d9abc2764b11f599f5e7bbe0c8 Can I set the above configuration? (type 'yes' to accept): yes >>> Nodes configuration updated >>> Assign a different config epoch to each node >>> Sending CLUSTER MEET messages to join the cluster Waiting for the cluster to join.... >>> Performing Cluster Check (using node 192.88.29.250:7000) M: fd815645707134eb8b83a0e7514ab9024ed7b6da 192.88.29.250:7000 slots:0-5460 (5461 slots) master 1 additional replica(s) S: fa1d015f3f72fe7b0d8ec9c54dd3e8b874009725 192.88.29.250:7004 slots: (0 slots) slave replicates aaea373f41c98067e7783e452cecd9d9d145a273 S: b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005 slots: (0 slots) slave replicates eafad428987282d9abc2764b11f599f5e7bbe0c8 M: aaea373f41c98067e7783e452cecd9d9d145a273 192.88.29.200:7001 slots:5461-10922 (5462 slots) master 1 additional replica(s) M: eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002 slots:10923-16383 (5461 slots) master 1 additional replica(s) S: cad78846d6e8d3a47c3adeee2409b1433207b559 192.88.29.200:7003 slots: (0 slots) slave replicates fd815645707134eb8b83a0e7514ab9024ed7b6da [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered.
解釋:
redis-trib.rb create --replicas 1 192.88.29.250:7000 192.88.29.250:7002 192.88.29.250:7004 192.88.29.200:7001 192.88.29.200:7003 192.88.29.200:7005
#分配6個端口,寫在最前面的3個端口爲主,其他的3個爲從
>>> Performing hash slots allocation on 6 nodes... Using 3 masters: 192.88.29.250:7000 192.88.29.200:7001 192.88.29.250:7002 Adding replica 192.88.29.200:7003 to 192.88.29.250:7000 Adding replica 192.88.29.250:7004 to 192.88.29.200:7001 Adding replica 192.88.29.200:7005 to 192.88.29.250:7002
21.25 redis集羣操做
#檢查 集羣狀態
redis-trib.rb check 192.168.133.130:7000
# redis-trib.rb check 192.88.29.250:7000 >>> Performing Cluster Check (using node 192.88.29.250:7000) M: fd815645707134eb8b83a0e7514ab9024ed7b6da 192.88.29.250:7000 slots:0-5460 (5461 slots) master 1 additional replica(s) S: fa1d015f3f72fe7b0d8ec9c54dd3e8b874009725 192.88.29.250:7004 slots: (0 slots) slave replicates aaea373f41c98067e7783e452cecd9d9d145a273 S: b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005 slots: (0 slots) slave replicates eafad428987282d9abc2764b11f599f5e7bbe0c8 S: d4ea65e82c1d10192bc8a0c8a21f390485a88cf8 192.88.29.250:7006 slots: (0 slots) slave replicates 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c M: 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c 192.88.29.200:7007 slots: (0 slots) master 1 additional replica(s) M: aaea373f41c98067e7783e452cecd9d9d145a273 192.88.29.200:7001 slots:5461-10922 (5462 slots) master 1 additional replica(s) M: eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002 slots:10923-16383 (5461 slots) master 1 additional replica(s) S: cad78846d6e8d3a47c3adeee2409b1433207b559 192.88.29.200:7003 slots: (0 slots) slave replicates fd815645707134eb8b83a0e7514ab9024ed7b6da [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered.
redis-cli -c -h 192.88.29.250 -p 7000 //-c說明以集羣的方式登陸
# redis-cli -c -h 192.88.29.250 -p 7000 192.88.29.250:7000> set key1 123 -> Redirected to slot [9189] located at 192.88.29.200:7001 OK #located at 是指key指向後接的ip:port 192.88.29.200:7001> set key2 234 -> Redirected to slot [4998] located at 192.88.29.250:7000 OK 192.88.29.250:7000> set key3 345 OK #當沒有出現located at的ip的時候,那麼key就是存在本機了
任意一個節點均可以建立key,或者查看key(演示)
redis-trib.rb check 192.88.29.250:7000//檢測集羣狀態 # redis-trib.rb check 192.88.29.250:7000 >>> Performing Cluster Check (using node 192.88.29.250:7000) M: fd815645707134eb8b83a0e7514ab9024ed7b6da 192.88.29.250:7000 slots:0-5460 (5461 slots) master 1 additional replica(s) S: fa1d015f3f72fe7b0d8ec9c54dd3e8b874009725 192.88.29.250:7004 slots: (0 slots) slave replicates aaea373f41c98067e7783e452cecd9d9d145a273 S: b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005 slots: (0 slots) slave replicates eafad428987282d9abc2764b11f599f5e7bbe0c8 M: aaea373f41c98067e7783e452cecd9d9d145a273 192.88.29.200:7001 slots:5461-10922 (5462 slots) master 1 additional replica(s) M: eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002 slots:10923-16383 (5461 slots) master 1 additional replica(s) S: cad78846d6e8d3a47c3adeee2409b1433207b559 192.88.29.200:7003 slots: (0 slots) slave replicates fd815645707134eb8b83a0e7514ab9024ed7b6da [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered.
解釋:
M表示master
S表示salve
查看任意一個ip:port也是輸出一樣信息,只要在同一個cluster便可。
關於cluster相關的命令
cluster nodes//列出節點
# redis-cli -c -h 192.88.29.250 -p 7000 192.88.29.250:7000> CLUSTER NODES fa1d015f3f72fe7b0d8ec9c54dd3e8b874009725 192.88.29.250:7004@17004 slave aaea373f41c98067e7783e452cecd9d9d145a273 0 1535423473000 4 connected b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005@17005 slave eafad428987282d9abc2764b11f599f5e7bbe0c8 0 1535423473000 6 connected aaea373f41c98067e7783e452cecd9d9d145a273 192.88.29.200:7001@17001 master - 0 1535423472175 4 connected 5461-10922 eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002@17002 master - 0 1535423473193 2 connected 10923-16383 cad78846d6e8d3a47c3adeee2409b1433207b559 192.88.29.200:7003@17003 slave fd815645707134eb8b83a0e7514ab9024ed7b6da 0 1535423474215 5 connected fd815645707134eb8b83a0e7514ab9024ed7b6da 192.88.29.250:7000@17000 myself,master - 0 1535423472000 1 connected 0-5460
解釋:
行首位置的字符串,與其餘行中的master,slave後接的字符串是匹配的,匹配是指主從角色。
例如
b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005@17005 slave eafad428987282d9abc2764b11f599f5e7bbe0c8 0 1535423473000 6 connected eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002@17002 master - 0 1535423473193 2 connected 10923-16383
當看到slave
eafad428987282d9abc2764b11f599f5e7bbe0c8 #能夠理解他是eafad428987282d9abc2764b11f599f5e7bbe0c8的從,那麼eafad428987282d9abc2764b11f599f5e7bbe0c8就是 192.88.29.250:7002
#查看集羣信息
cluster info 192.88.29.250:7000> 192.88.29.250:7000> CLUSTER INFO cluster_state:ok cluster_slots_assigned:16384 cluster_slots_ok:16384 cluster_slots_pfail:0 cluster_slots_fail:0 cluster_known_nodes:6 cluster_size:3 cluster_current_epoch:6 cluster_my_epoch:1 cluster_stats_messages_ping_sent:62371 cluster_stats_messages_pong_sent:65332 cluster_stats_messages_sent:127703 cluster_stats_messages_ping_received:65327 cluster_stats_messages_pong_received:62371 cluster_stats_messages_meet_received:5 cluster_stats_messages_received:127703
#添加節點
cluster meet ip port 192.88.29.250:7000> CLUSTER MEET 192.88.29.200 7007 OK 192.88.29.250:7000> CLUSTER MEET 192.88.29.250 7006 OK 192.88.29.250:7000> CLUSTER NODES fa1d015f3f72fe7b0d8ec9c54dd3e8b874009725 192.88.29.250:7004@17004 slave aaea373f41c98067e7783e452cecd9d9d145a273 0 1535425488606 4 connected b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005@17005 slave eafad428987282d9abc2764b11f599f5e7bbe0c8 0 1535425486000 6 connected d4ea65e82c1d10192bc8a0c8a21f390485a88cf8 192.88.29.250:7006@17006 master - 0 1535425487690 0 connected 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c 192.88.29.200:7007@17007 master - 0 1535425486565 0 connected aaea373f41c98067e7783e452cecd9d9d145a273 192.88.29.200:7001@17001 master - 0 1535425485543 4 connected 5461-10922 eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002@17002 master - 0 1535425487586 2 connected 10923-16383 cad78846d6e8d3a47c3adeee2409b1433207b559 192.88.29.200:7003@17003 slave fd815645707134eb8b83a0e7514ab9024ed7b6da 0 1535425486000 5 connected fd815645707134eb8b83a0e7514ab9024ed7b6da 192.88.29.250:7000@17000 myself,master - 0 1535425487000 1 connected 0-5460 #發現新增的2個port都是默認master
cluster forget node_id //移除某個節點
注意:
不能移除當前節點--》登陸到別的port進行移除指定節點
不能移除master--》除非是將master設爲salve才能夠進行移除
#將當前節點設置爲指定節點的從
#cluster replicate node_id 例如,如今要將7006設爲7007的從 登陸須要設置爲從的ip:port 而後指定7007的node_id # redis-cli -c -h 192.88.29.250 -p 7006 192.88.29.250:7006> CLUSTER NODES d4ea65e82c1d10192bc8a0c8a21f390485a88cf8 192.88.29.250:7006@17006 myself,master - 0 1535426333000 0 connected 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c 192.88.29.200:7007@17007 master - 0 1535426335861 7 connected #找到對應的2個port以後,記住7007的node id號,接下來要指定主從角色 192.88.29.250:7006> CLUSTER REPLICATE 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c OK #將7006爲7007的從 #輸出值是理想效果 192.88.29.250:7006> CLUSTER NODES d4ea65e82c1d10192bc8a0c8a21f390485a88cf8 192.88.29.250:7006@17006 myself,slave 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c 0 1535426370000 0 connected 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c 192.88.29.200:7007@17007 master - 0 1535426371686 7 connected
#保存配置文件
cluster saveconfig 192.88.29.250:7000> CLUSTER SAVECONFIG OK 保存好的配置文件,在設置好的數據目錄 #ls /data/redis_data/7000/nodes_7000.conf /data/redis_data/7000/nodes_7000.conf # cat /data/redis_data/7000/nodes_7000.conf fa1d015f3f72fe7b0d8ec9c54dd3e8b874009725 192.88.29.250:7004@17004 slave aaea373f41c98067e7783e452cecd9d9d145a273 0 1535426979316 4 connected b95c0e5ad24f3cf707d3ffc71bf9e3686e3e4b93 192.88.29.200:7005@17005 slave eafad428987282d9abc2764b11f599f5e7bbe0c8 0 1535426977081 6 connected d4ea65e82c1d10192bc8a0c8a21f390485a88cf8 192.88.29.250:7006@17006 slave 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c 0 1535426979000 7 connected 1f0c8bcf5405b85b49d51d55809c1f1b1aa08f9c 192.88.29.200:7007@17007 master - 0 1535426977282 7 connected aaea373f41c98067e7783e452cecd9d9d145a273 192.88.29.200:7001@17001 master - 0 1535426978301 4 connected 5461-10922 eafad428987282d9abc2764b11f599f5e7bbe0c8 192.88.29.250:7002@17002 master - 0 1535426975000 2 connected 10923-16383 cad78846d6e8d3a47c3adeee2409b1433207b559 192.88.29.200:7003@17003 slave fd815645707134eb8b83a0e7514ab9024ed7b6da 0 1535426978099 5 connected fd815645707134eb8b83a0e7514ab9024ed7b6da 192.88.29.250:7000@17000 myself,master - 0 1535426974000 1 connected 0-5460 vars currentEpoch 7 lastVoteEpoch 0
!!!當保存cluster配置文件後每一個端口都會生成一個配置文件
tree /data/redis_data/ /data/redis_data/ ├── 7000 │ ├── appendonly.aof │ ├── dump.rdb │ └── nodes_7000.conf ├── 7002 │ ├── appendonly.aof │ ├── dump.rdb │ └── nodes_7002.conf ├── 7004 │ ├── appendonly.aof │ ├── dump.rdb │ └── nodes_7004.conf └── 7006 ├── appendonly.aof ├── dump.rdb └── nodes_7006.conf