forked from AliyunContainerService/redis-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·32 lines (28 loc) · 1.37 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
MASTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' redis-cluster_master_1)
SLAVE_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' redis-cluster_slave_1)
SENTINEL_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' redis-cluster_sentinel_1)
echo Redis master: $MASTER_IP
echo Redis Slave: $SLAVE_IP
echo ------------------------------------------------
echo Initial status of sentinel
echo ------------------------------------------------
docker exec redis-cluster_sentinel_1 redis-cli -p 26379 info Sentinel
echo Current master is
docker exec redis-cluster_sentinel_1 redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster
echo ------------------------------------------------
echo Stop redis master
docker pause redis-cluster_master_1
echo Wait for 10 seconds
sleep 10
echo Current infomation of sentinel
docker exec redis-cluster_sentinel_1 redis-cli -p 26379 info Sentinel
echo Current master is
docker exec redis-cluster_sentinel_1 redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster
echo ------------------------------------------------
echo Restart Redis master
docker unpause redis-cluster_master_1
sleep 5
echo Current infomation of sentinel
docker exec redis-cluster_sentinel_1 redis-cli -p 26379 info Sentinel
echo Current master is
docker exec redis-cluster_sentinel_1 redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster