Codis3.2クラスターHA高可用性方案
18599 ワード
Codis3.2クラスターHA高可用性方案
Codis高可用性スキームの公式推奨使用Sentine
Redis自体が最終的に一致している.Masterが切れ、Promote Slaveが新しいMasterになるまで時間がかかります(テスト15秒以内).実はCentinelはこの論理です.Codis3.2自分はHAを実現していないで、直接Sentineに依存します.
注意事項:
Centinelは、Codis 3以上のバージョンのオリジナルのRedis-serverを使用する必要があります.2の中の3.2.8バージョン、ここはRedis 3です.2.9の下でテストを配置し、またProtected-mode noという保護モードを閉じる必要があります.confのデフォルト構成では主従関係を書く必要はありません.Codif-feインタフェースSYNCは主従関係を読み込みます.
1,各Groupの前のSYNCは,主従関係を含む,ブラシgroupに関連するSlotのルーティングテーブルをProxyに与える.
2,Sentineの前のSYNCはすべてのSentineブラシに配置され、同時にSentineリストを各Proxyにブラシします.したがって,クラスタ構築が完了した後,あるいはRedis serverを追加・削除するたびに(安定した後),Sentineの下にSYNCを1回クリックすればよい.
3,Codis3.2のは同時移行+非同期移行の問題のみを解決した.HAに関する仕事はしません.だから3.2で問題を解決すれば、Sentinelで十分で、Sentinelしか使えません.Sentinalが担当するのはGroup内の主従切替である.
4、カーネル最適化
echo never >/sys/kernel/mm/transparent_hugepage/enabled
sysctl vm.overcommit_memory=1
一、Codisクラスタアーキテクチャ
二、Codis-serverの構成
仮想マシン1台あたり3つのインスタンス:6379、6380、6381、合計18のインスタンス
三、Groupの構成
1マスター2スレーブの6つのグループを設定し、マスター3つのインスタンスから3台の仮想マシンが必要であることに注意します.
四、Sentinalの構成
6つのCentinelを構成する必要があります.仮想マシン上の1つはありません.
注意このオリジナルはsentinelのプロファイルに配置され、3.2.9のオリジナルのsentinel配置の下で、またprotected-mode noという保護モードは閉じる必要があります、sentinel.confのデフォルト構成では主従関係を書く必要はありません.Codif-feインタフェースSYNCは主従関係を読み込みます.
1、構成情報
[root@codis120 config]# cat sentinel.conf |grep -Ev "^#|^$"
2 sentinelを起動し、複数のSentineが選挙に便利で、高可用性を保証します.
3,SYNC後ログで哨兵記録を確認する
4、グラフィックインタフェースで見ることもできます
http://192.168.188.125:18080/api/topom/sentinels/info/192.168.188.120:26379/monitored
5、最終プロファイル照合
新しいコンテンツはsentinelに保存されました.confの中に
[root@codis120 config]# cat sentinel.conf |grep -Ev "^#|^$"
五、Group内主従切替テスト
Group 3テスト
Group 3(主従)
192.168.188.122:6379 192.168.188.123:6380 192.168.188.125:6381
1,まず、192.168.188.122:6379を停止
[root@codis122 admin]#/usr/local/codis/admin/codis-server-admin-6379.sh stop
/usr/local/codis/admin/../config/redis-6379.conf
stopping codis-server ...
STOPPED
2,192.168.188.125:6381が主に選ばれたことが検出され、切替過程は約15秒以内だった.
3,最後に192.168.188.122:6379を起動し、Group 3の1つになりました.
[root@codis122 admin]#/usr/local/codis/admin/codis-server-admin-6379.sh start
/usr/local/codis/admin/../config/redis-6379.conf
starting codis-server ...
18701:X 19 Sep 11:52:07.331 # -sdown slave 192.168.188.122:6379 192.168.188.122 6379 @ codis-easypass-3 192.168.188.125 6381
Codis高可用性スキームの公式推奨使用Sentine
Redis自体が最終的に一致している.Masterが切れ、Promote Slaveが新しいMasterになるまで時間がかかります(テスト15秒以内).実はCentinelはこの論理です.Codis3.2自分はHAを実現していないで、直接Sentineに依存します.
注意事項:
Centinelは、Codis 3以上のバージョンのオリジナルのRedis-serverを使用する必要があります.2の中の3.2.8バージョン、ここはRedis 3です.2.9の下でテストを配置し、またProtected-mode noという保護モードを閉じる必要があります.confのデフォルト構成では主従関係を書く必要はありません.Codif-feインタフェースSYNCは主従関係を読み込みます.
1,各Groupの前のSYNCは,主従関係を含む,ブラシgroupに関連するSlotのルーティングテーブルをProxyに与える.
2,Sentineの前のSYNCはすべてのSentineブラシに配置され、同時にSentineリストを各Proxyにブラシします.したがって,クラスタ構築が完了した後,あるいはRedis serverを追加・削除するたびに(安定した後),Sentineの下にSYNCを1回クリックすればよい.
3,Codis3.2のは同時移行+非同期移行の問題のみを解決した.HAに関する仕事はしません.だから3.2で問題を解決すれば、Sentinelで十分で、Sentinelしか使えません.Sentinalが担当するのはGroup内の主従切替である.
4、カーネル最適化
echo never >/sys/kernel/mm/transparent_hugepage/enabled
sysctl vm.overcommit_memory=1
一、Codisクラスタアーキテクチャ
192.168.188.120 codis120 codis-server zookeeper sentinel
192.168.188.121 codis121 codis-server zookeeper sentinel
192.168.188.122 codis122 codis-server zookeeper sentinel
192.168.188.123 codis123 codis-server codis-proxy sentinellvs
192.168.188.124 codis124 codis-server codis-proxy sentinellvs
192.168.188.125 codis125 codis-server codis-dashboard sentinelcodis-fe
二、Codis-serverの構成
仮想マシン1台あたり3つのインスタンス:6379、6380、6381、合計18のインスタンス
192.168.188.120:6379、6380、6381
192.168.188.121:6379、6380、6381
192.168.188.122:6379、6380、6381
192.168.188.123:6379、6380、6381
192.168.188.124:6379、6380、6381
192.168.188.125:6379、6380、6381
三、Groupの構成
1マスター2スレーブの6つのグループを設定し、マスター3つのインスタンスから3台の仮想マシンが必要であることに注意します.
Group1( )
192.168.188.120:6379 192.168.188.121:6380 192.168.188.123:6381
Group2( )
192.168.188.121:6379 192.168.188.120:6380 192.168.188.124:6381
Group3( )
192.168.188.122:6379 192.168.188.123:6380 192.168.188.125:6381
Group4( )
192.168.188.123:6379 192.168.188.122:6380 192.168.188.120:6381
Group5( )
192.168.188.124:6379 192.168.188.125:6380 192.168.188.121:6381
Group6( )
192.168.188.125:6379 192.168.188.124:6380 192.168.188.122:6381
四、Sentinalの構成
6つのCentinelを構成する必要があります.仮想マシン上の1つはありません.
注意このオリジナルはsentinelのプロファイルに配置され、3.2.9のオリジナルのsentinel配置の下で、またprotected-mode noという保護モードは閉じる必要があります、sentinel.confのデフォルト構成では主従関係を書く必要はありません.Codif-feインタフェースSYNCは主従関係を読み込みます.
1、構成情報
[root@codis120 config]# cat sentinel.conf |grep -Ev "^#|^$"
protected-mode no
port 26379
dir "/tmp"
2 sentinelを起動し、複数のSentineが選挙に便利で、高可用性を保証します.
192.168.188.120:26379
192.168.188.120:26379
192.168.188.120:26379
192.168.188.120:26379
192.168.188.120:26379
192.168.188.120:26379
3,SYNC後ログで哨兵記録を確認する
20980:X 19 Sep 10:53:28.965 # +monitor master codis-easypass-2 192.168.188.121 6379 quorum 2
20980:X 19 Sep 10:53:28.965 # +set master codis-easypass-2 192.168.188.121 6379 parallel-syncs 1
20980:X 19 Sep 10:53:28.965 # +set master codis-easypass-2 192.168.188.121 6379 down-after-milliseconds 30000
20980:X 19 Sep 10:53:28.965 # +set master codis-easypass-2 192.168.188.121 6379 failover-timeout 300000
20980:X 19 Sep 10:53:28.967 * +slave slave 192.168.188.120:6380 192.168.188.120 6380 @ codis-easypass-2 192.168.188.121 6379
20980:X 19 Sep 10:53:28.969 * +slave slave 192.168.188.124:6381 192.168.188.124 6381 @ codis-easypass-2 192.168.188.121 6379
20980:X 19 Sep 10:53:28.973 # +monitor master codis-easypass-3 192.168.188.122 6379 quorum 2
20980:X 19 Sep 10:53:28.973 # +set master codis-easypass-3 192.168.188.122 6379 parallel-syncs 1
20980:X 19 Sep 10:53:28.973 # +set master codis-easypass-3 192.168.188.122 6379 down-after-milliseconds 30000
20980:X 19 Sep 10:53:28.973 # +set master codis-easypass-3 192.168.188.122 6379 failover-timeout 300000
20980:X 19 Sep 10:53:28.997 # +monitor master codis-easypass-4 192.168.188.123 6379 quorum 2
20980:X 19 Sep 10:53:28.997 # +set master codis-easypass-4 192.168.188.123 6379 parallel-syncs 1
20980:X 19 Sep 10:53:28.997 # +set master codis-easypass-4 192.168.188.123 6379 down-after-milliseconds 30000
20980:X 19 Sep 10:53:28.997 # +set master codis-easypass-4 192.168.188.123 6379 failover-timeout 300000
20980:X 19 Sep 10:53:29.001 # +monitor master codis-easypass-5 192.168.188.124 6379 quorum 2
20980:X 19 Sep 10:53:29.002 # +set master codis-easypass-5 192.168.188.124 6379 parallel-syncs 1
20980:X 19 Sep 10:53:29.002 # +set master codis-easypass-5 192.168.188.124 6379 down-after-milliseconds 30000
20980:X 19 Sep 10:53:29.002 # +set master codis-easypass-5 192.168.188.124 6379 failover-timeout 300000
20980:X 19 Sep 10:53:29.006 # +monitor master codis-easypass-6 192.168.188.125 6379 quorum 2
20980:X 19 Sep 10:53:29.006 # +set master codis-easypass-6 192.168.188.125 6379 parallel-syncs 1
20980:X 19 Sep 10:53:29.006 # +set master codis-easypass-6 192.168.188.125 6379 down-after-milliseconds 30000
20980:X 19 Sep 10:53:29.006 # +set master codis-easypass-6 192.168.188.125 6379 failover-timeout 300000
20980:X 19 Sep 10:53:29.010 # +monitor master codis-easypass-1 192.168.188.120 6379 quorum 2
20980:X 19 Sep 10:53:29.010 # +set master codis-easypass-1 192.168.188.120 6379 parallel-syncs 1
20980:X 19 Sep 10:53:29.010 # +set master codis-easypass-1 192.168.188.120 6379 down-after-milliseconds 30000
20980:X 19 Sep 10:53:29.010 # +set master codis-easypass-1 192.168.188.120 6379 failover-timeout 300000
20980:X 19 Sep 10:53:29.029 * +slave slave 192.168.188.121:6380 192.168.188.121 6380 @ codis-easypass-1 192.168.188.120 6379
20980:X 19 Sep 10:53:29.031 * +slave slave 192.168.188.123:6381 192.168.188.123 6381 @ codis-easypass-1 192.168.188.120 6379
20980:X 19 Sep 10:53:29.033 * +slave slave 192.168.188.124:6380 192.168.188.124 6380 @ codis-easypass-6 192.168.188.125 6379
20980:X 19 Sep 10:53:29.036 * +slave slave 192.168.188.122:6381 192.168.188.122 6381 @ codis-easypass-6 192.168.188.125 6379
20980:X 19 Sep 10:53:29.038 * +slave slave 192.168.188.123:6380 192.168.188.123 6380 @ codis-easypass-3 192.168.188.122 6379
20980:X 19 Sep 10:53:29.040 * +slave slave 192.168.188.125:6381 192.168.188.125 6381 @ codis-easypass-3 192.168.188.122 6379
20980:X 19 Sep 10:53:29.042 * +slave slave 192.168.188.122:6380 192.168.188.122 6380 @ codis-easypass-4 192.168.188.123 6379
20980:X 19 Sep 10:53:29.044 * +slave slave 192.168.188.120:6381 192.168.188.120 6381 @ codis-easypass-4 192.168.188.123 6379
20980:X 19 Sep 10:53:29.047 * +slave slave 192.168.188.125:6380 192.168.188.125 6380 @ codis-easypass-5 192.168.188.124 6379
20980:X 19 Sep 10:53:29.049 * +slave slave 192.168.188.121:6381 192.168.188.121 6381 @ codis-easypass-5 192.168.188.124 6379
20980:X 19 Sep 10:53:30.958 * +sentinel sentinel 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54 192.168.188.123 26379 @ codis-easypass-4 192.168.188.123 6379
20980:X 19 Sep 10:53:30.960 * +sentinel sentinel 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54 192.168.188.123 26379 @ codis-easypass-3 192.168.188.122 6379
20980:X 19 Sep 10:53:30.962 * +sentinel sentinel 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54 192.168.188.123 26379 @ codis-easypass-2 192.168.188.121 6379
20980:X 19 Sep 10:53:30.965 * +sentinel sentinel 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54 192.168.188.123 26379 @ codis-easypass-6 192.168.188.125 6379
20980:X 19 Sep 10:53:30.976 * +sentinel sentinel 28758dd53514376486fdec2acdb73f273fa90645 192.168.188.121 26379 @ codis-easypass-2 192.168.188.121 6379
20980:X 19 Sep 10:53:30.978 * +sentinel sentinel 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54 192.168.188.123 26379 @ codis-easypass-5 192.168.188.124 6379
20980:X 19 Sep 10:53:30.981 * +sentinel sentinel 28758dd53514376486fdec2acdb73f273fa90645 192.168.188.121 26379 @ codis-easypass-3 192.168.188.122 6379
20980:X 19 Sep 10:53:30.989 * +sentinel sentinel 2204a1a2c3c5387bb33ab34de52c4eeda59257d4 192.168.188.122 26379 @ codis-easypass-2 192.168.188.121 6379
20980:X 19 Sep 10:53:30.991 * +sentinel sentinel 2204a1a2c3c5387bb33ab34de52c4eeda59257d4 192.168.188.122 26379 @ codis-easypass-4 192.168.188.123 6379
20980:X 19 Sep 10:53:30.993 * +sentinel sentinel 2204a1a2c3c5387bb33ab34de52c4eeda59257d4 192.168.188.122 26379 @ codis-easypass-3 192.168.188.122 6379
20980:X 19 Sep 10:53:31.001 * +sentinel sentinel d0268512448981b56e0eb76318af009b4575404c 192.168.188.125 26379 @ codis-easypass-6 192.168.188.125 6379
20980:X 19 Sep 10:53:31.003 * +sentinel sentinel d0268512448981b56e0eb76318af009b4575404c 192.168.188.125 26379 @ codis-easypass-1 192.168.188.120 6379
20980:X 19 Sep 10:53:31.005 * +sentinel sentinel d0268512448981b56e0eb76318af009b4575404c 192.168.188.125 26379 @ codis-easypass-4 192.168.188.123 6379
20980:X 19 Sep 10:53:31.008 * +sentinel sentinel d0268512448981b56e0eb76318af009b4575404c 192.168.188.125 26379 @ codis-easypass-3 192.168.188.122 6379
20980:X 19 Sep 10:53:31.010 * +sentinel sentinel d0268512448981b56e0eb76318af009b4575404c 192.168.188.125 26379 @ codis-easypass-2 192.168.188.121 6379
20980:X 19 Sep 10:53:31.012 * +sentinel sentinel d0268512448981b56e0eb76318af009b4575404c 192.168.188.125 26379 @ codis-easypass-5 192.168.188.124 6379
20980:X 19 Sep 10:53:31.015 * +sentinel sentinel 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54 192.168.188.123 26379 @ codis-easypass-1 192.168.188.120 6379
20980:X 19 Sep 10:53:31.052 * +sentinel sentinel 28758dd53514376486fdec2acdb73f273fa90645 192.168.188.121 26379 @ codis-easypass-6 192.168.188.125 6379
20980:X 19 Sep 10:53:31.055 * +sentinel sentinel 28758dd53514376486fdec2acdb73f273fa90645 192.168.188.121 26379 @ codis-easypass-1 192.168.188.120 6379
20980:X 19 Sep 10:53:31.058 * +sentinel sentinel 28758dd53514376486fdec2acdb73f273fa90645 192.168.188.121 26379 @ codis-easypass-4 192.168.188.123 6379
20980:X 19 Sep 10:53:31.059 * +sentinel sentinel 28758dd53514376486fdec2acdb73f273fa90645 192.168.188.121 26379 @ codis-easypass-5 192.168.188.124 6379
20980:X 19 Sep 10:53:31.062 * +sentinel sentinel 2204a1a2c3c5387bb33ab34de52c4eeda59257d4 192.168.188.122 26379 @ codis-easypass-6 192.168.188.125 6379
20980:X 19 Sep 10:53:31.069 * +sentinel sentinel 2204a1a2c3c5387bb33ab34de52c4eeda59257d4 192.168.188.122 26379 @ codis-easypass-5 192.168.188.124 6379
20980:X 19 Sep 10:53:31.071 * +sentinel sentinel 2204a1a2c3c5387bb33ab34de52c4eeda59257d4 192.168.188.122 26379 @ codis-easypass-1 192.168.188.120 6379
20980:X 19 Sep 10:53:31.276 * +sentinel sentinel 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 192.168.188.124 26379 @ codis-easypass-4 192.168.188.123 6379
20980:X 19 Sep 10:53:31.292 * +sentinel sentinel 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 192.168.188.124 26379 @ codis-easypass-6 192.168.188.125 6379
20980:X 19 Sep 10:53:31.303 * +sentinel sentinel 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 192.168.188.124 26379 @ codis-easypass-3 192.168.188.122 6379
20980:X 19 Sep 10:53:31.314 * +sentinel sentinel 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 192.168.188.124 26379 @ codis-easypass-2 192.168.188.121 6379
20980:X 19 Sep 10:53:31.322 * +sentinel sentinel 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 192.168.188.124 26379 @ codis-easypass-5 192.168.188.124 6379
20980:X 19 Sep 10:53:31.325 * +sentinel sentinel 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 192.168.188.124 26379 @ codis-easypass-1 192.168.188.120 6379
4、グラフィックインタフェースで見ることもできます
http://192.168.188.125:18080/api/topom/sentinels/info/192.168.188.120:26379/monitored
5、最終プロファイル照合
新しいコンテンツはsentinelに保存されました.confの中に
[root@codis120 config]# cat sentinel.conf |grep -Ev "^#|^$"
protected-mode no
port 26379
dir "/tmp"
sentinel myid 620b655b311656aa6016e6b864b0f2a8fb03d453
sentinel monitor codis-easypass-6 192.168.188.125 6379 2
sentinel failover-timeout codis-easypass-6 300000
sentinel config-epoch codis-easypass-6 0
sentinel leader-epoch codis-easypass-6 0
sentinel known-slave codis-easypass-6 192.168.188.124 6380
sentinel known-slave codis-easypass-6 192.168.188.122 6381
sentinel known-sentinel codis-easypass-6 192.168.188.125 26379 d0268512448981b56e0eb76318af009b4575404c
sentinel known-sentinel codis-easypass-6 192.168.188.121 26379 28758dd53514376486fdec2acdb73f273fa90645
sentinel known-sentinel codis-easypass-6 192.168.188.123 26379 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54
sentinel known-sentinel codis-easypass-6 192.168.188.122 26379 2204a1a2c3c5387bb33ab34de52c4eeda59257d4
sentinel known-sentinel codis-easypass-6 192.168.188.124 26379 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9
sentinel monitor codis-easypass-2 192.168.188.121 6379 2
sentinel failover-timeout codis-easypass-2 300000
sentinel config-epoch codis-easypass-2 0
sentinel leader-epoch codis-easypass-2 0
sentinel known-slave codis-easypass-2 192.168.188.120 6380
sentinel known-slave codis-easypass-2 192.168.188.124 6381
sentinel known-sentinel codis-easypass-2 192.168.188.125 26379 d0268512448981b56e0eb76318af009b4575404c
sentinel known-sentinel codis-easypass-2 192.168.188.121 26379 28758dd53514376486fdec2acdb73f273fa90645
sentinel known-sentinel codis-easypass-2 192.168.188.123 26379 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54
sentinel known-sentinel codis-easypass-2 192.168.188.122 26379 2204a1a2c3c5387bb33ab34de52c4eeda59257d4
sentinel known-sentinel codis-easypass-2 192.168.188.124 26379 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9
sentinel monitor codis-easypass-1 192.168.188.120 6379 2
sentinel failover-timeout codis-easypass-1 300000
sentinel config-epoch codis-easypass-1 0
sentinel leader-epoch codis-easypass-1 0
sentinel known-slave codis-easypass-1 192.168.188.123 6381
sentinel known-slave codis-easypass-1 192.168.188.121 6380
sentinel known-sentinel codis-easypass-1 192.168.188.125 26379 d0268512448981b56e0eb76318af009b4575404c
sentinel known-sentinel codis-easypass-1 192.168.188.121 26379 28758dd53514376486fdec2acdb73f273fa90645
sentinel known-sentinel codis-easypass-1 192.168.188.123 26379 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54
sentinel known-sentinel codis-easypass-1 192.168.188.122 26379 2204a1a2c3c5387bb33ab34de52c4eeda59257d4
sentinel known-sentinel codis-easypass-1 192.168.188.124 26379 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9
sentinel monitor codis-easypass-3 192.168.188.122 6379 2
sentinel failover-timeout codis-easypass-3 300000
sentinel config-epoch codis-easypass-3 0
sentinel leader-epoch codis-easypass-3 0
sentinel known-slave codis-easypass-3 192.168.188.123 6380
sentinel known-slave codis-easypass-3 192.168.188.125 6381
sentinel known-sentinel codis-easypass-3 192.168.188.125 26379 d0268512448981b56e0eb76318af009b4575404c
sentinel known-sentinel codis-easypass-3 192.168.188.121 26379 28758dd53514376486fdec2acdb73f273fa90645
sentinel known-sentinel codis-easypass-3 192.168.188.123 26379 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54
sentinel known-sentinel codis-easypass-3 192.168.188.122 26379 2204a1a2c3c5387bb33ab34de52c4eeda59257d4
sentinel known-sentinel codis-easypass-3 192.168.188.124 26379 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9
sentinel monitor codis-easypass-4 192.168.188.123 6379 2
sentinel failover-timeout codis-easypass-4 300000
sentinel config-epoch codis-easypass-4 0
sentinel leader-epoch codis-easypass-4 0
sentinel known-slave codis-easypass-4 192.168.188.120 6381
sentinel known-slave codis-easypass-4 192.168.188.122 6380
sentinel known-sentinel codis-easypass-4 192.168.188.125 26379 d0268512448981b56e0eb76318af009b4575404c
sentinel known-sentinel codis-easypass-4 192.168.188.121 26379 28758dd53514376486fdec2acdb73f273fa90645
sentinel known-sentinel codis-easypass-4 192.168.188.123 26379 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54
sentinel known-sentinel codis-easypass-4 192.168.188.122 26379 2204a1a2c3c5387bb33ab34de52c4eeda59257d4
sentinel known-sentinel codis-easypass-4 192.168.188.124 26379 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9
sentinel monitor codis-easypass-5 192.168.188.124 6379 2
sentinel failover-timeout codis-easypass-5 300000
sentinel config-epoch codis-easypass-5 0
sentinel leader-epoch codis-easypass-5 0
sentinel known-slave codis-easypass-5 192.168.188.125 6380
sentinel known-slave codis-easypass-5 192.168.188.121 6381
sentinel known-sentinel codis-easypass-5 192.168.188.125 26379 d0268512448981b56e0eb76318af009b4575404c
sentinel known-sentinel codis-easypass-5 192.168.188.121 26379 28758dd53514376486fdec2acdb73f273fa90645
sentinel known-sentinel codis-easypass-5 192.168.188.123 26379 9c1ccd7b64d0eb0fa0be4db4b4b86e4b8aa79c54
sentinel known-sentinel codis-easypass-5 192.168.188.122 26379 2204a1a2c3c5387bb33ab34de52c4eeda59257d4
sentinel known-sentinel codis-easypass-5 192.168.188.124 26379 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9
sentinel current-epoch 0
五、Group内主従切替テスト
Group 3テスト
Group 3(主従)
192.168.188.122:6379 192.168.188.123:6380 192.168.188.125:6381
1,まず、192.168.188.122:6379を停止
[root@codis122 admin]#/usr/local/codis/admin/codis-server-admin-6379.sh stop
/usr/local/codis/admin/../config/redis-6379.conf
stopping codis-server ...
STOPPED
2,192.168.188.125:6381が主に選ばれたことが検出され、切替過程は約15秒以内だった.
8980:X 19 Sep 11:51:17.416 # +sdown master codis-easypass-3 192.168.188.122 6379
8980:X 19 Sep 11:51:17.461 # +new-epoch 1
8980:X 19 Sep 11:51:17.462 # +vote-for-leader 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 1
8980:X 19 Sep 11:51:17.488 # +odown master codis-easypass-3 192.168.188.122 6379 #quorum 6/2
8980:X 19 Sep 11:51:17.488 # Next failover delay: I will not start a failover before Tue Sep 19 12:01:17 2017
8980:X 19 Sep 11:51:18.283 # +config-update-from sentinel 6ee9b78f205908be1bbbe5dc9cc5a55cb6d1f3f9 192.168.188.124 26379 @ codis-easypass-3 192.168.188.122 6379
8980:X 19 Sep 11:51:18.283 # +switch-master codis-easypass-3 192.168.188.122 6379 192.168.188.125 6381
8980:X 19 Sep 11:51:18.284 * +slave slave 192.168.188.123:6380 192.168.188.123 6380 @ codis-easypass-3 192.168.188.125 6381
8980:X 19 Sep 11:51:18.284 * +slave slave 192.168.188.122:6379 192.168.188.122 6379 @ codis-easypass-3 192.168.188.125 6381
8980:X 19 Sep 11:51:48.285 # +sdown slave 192.168.188.122:6379 192.168.188.122 6379 @ codis-easypass-3 192.168.188.125 6381
8980:X 19 Sep 11:52:07.256 # -sdown slave 192.168.188.122:6379 192.168.188.122 6379 @ codis-easypass-3 192.168.188.125 6381
3,最後に192.168.188.122:6379を起動し、Group 3の1つになりました.
[root@codis122 admin]#/usr/local/codis/admin/codis-server-admin-6379.sh start
/usr/local/codis/admin/../config/redis-6379.conf
starting codis-server ...
18701:X 19 Sep 11:52:07.331 # -sdown slave 192.168.188.122:6379 192.168.188.122 6379 @ codis-easypass-3 192.168.188.125 6381