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.36 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 }}' rediscluster_master_1)
SLAVE_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' rediscluster_slave_1)
SENTINEL_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' rediscluster_sentinel_1)
echo Redis master: $MASTER_IP
echo Redis Slave: $SLAVE_IP
echo ------------------------------------------------
echo Initial status of sentinel
echo ------------------------------------------------
docker exec rediscluster_sentinel_1 redis-cli -p 26379 info Sentinel
echo Current master is
docker exec rediscluster_sentinel_1 redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster
echo ------------------------------------------------
echo Stop redis master
docker pause rediscluster_master_1
echo Wait for 10 seconds
sleep 10
echo Current infomation of sentinel
docker exec rediscluster_sentinel_1 redis-cli -p 26379 info Sentinel
echo Current master is
docker exec rediscluster_sentinel_1 redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster
echo ------------------------------------------------
echo Restart Redis master
docker unpause rediscluster_master_1
sleep 5
echo Current infomation of sentinel
docker exec rediscluster_sentinel_1 redis-cli -p 26379 info Sentinel
echo Current master is
docker exec rediscluster_sentinel_1 redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster