File tree Expand file tree Collapse file tree 5 files changed +44
-25
lines changed Expand file tree Collapse file tree 5 files changed +44
-25
lines changed Original file line number Diff line number Diff line change 1
- redis-master :
2
- image : redis
3
- ports :
4
- - " 6379:6379"
5
- redis-slave :
6
- image : redis
7
- command : redis-server --slaveof redis-master 6379
8
- ports :
9
- - " 6379"
10
- links :
11
- - redis-master
12
- redis-sentinel :
13
- image : redis
14
- command : redis-sentinel /etc/redis/sentinel.conf
15
- volumes :
16
- - ./sentinel.conf:/etc/redis/sentinel.conf
17
- ports :
18
- - " 26379"
19
- links :
20
- - redis-master
21
- - redis-slave
1
+ services :
2
+ redis-master :
3
+ image : redis
4
+ redis-slave :
5
+ image : redis
6
+ command : redis-server --slaveof redis-master 6379
7
+ depends_on :
8
+ - redis-master
9
+ redis-sentinel :
10
+ image : redis
11
+ command : redis-sentinel /etc/redis/sentinel.conf
12
+ volumes :
13
+ - ./sentinel.conf:/etc/redis/sentinel.conf
14
+ depends_on :
15
+ - redis-master
16
+ - redis-slave
Original file line number Diff line number Diff line change
1
+
2
+ MASTER_IP=$( docker inspect --format ' {{.NetworkSettings.IPAddress}}' redis-cluster_master_1)
3
+ SLAVE_IP=$( docker inspect --format ' {{.NetworkSettings.IPAddress}}' redis-cluster_slave_1)
4
+ SENTINEL_IP=$( docker inspect --format ' {{.NetworkSettings.IPAddress}}' redis-cluster_sentinel_1)
Original file line number Diff line number Diff line change
1
+ # Sentinel Testing
2
+
3
+ To test sentinels, you need to set up master, slave and sentinel instances.
4
+
5
+ ## Setup
6
+
7
+ ``` bash
8
+ $ docker-compose -f config/sentinel/docker-compose.yaml up -d
9
+ [+] Running 3/3
10
+ ✔ Container sentinel-redis-master-1 Running 0.0s
11
+ ✔ Container sentinel-redis-slave-1 Running 0.0s
12
+ ✔ Container sentinel-redis-sentinel-1 Started 0.2s
13
+ ```
14
+
15
+ ## Test
16
+
17
+ ``` bash
18
+ $ ASYNC_REDIS_MASTER=redis://redis-master:6379 ASYNC_REDIS_SLAVE=redis://redis-slave:6379 ASYNC_REDIS_SENTINEL=redis://redis-sentinel:26379 bundle exec sus
19
+ ```
Original file line number Diff line number Diff line change 1
1
port 26379
2
+ sentinel resolve-hostnames yes
2
3
sentinel monitor mymaster redis-master 6379 1
3
4
sentinel down-after-milliseconds mymaster 1000
4
5
sentinel failover-timeout mymaster 1000
Original file line number Diff line number Diff line change 26
26
it "should resolve master address" do
27
27
unless master_host and slave_host and sentinel_host
28
28
skip ( "No sentinel host provided." )
29
-
30
- client . set ( "key" , "value" )
31
-
32
- expect ( slave_client . get ( "key" ) ) . to be == "value"
33
29
end
30
+
31
+ client . set ( "key" , "value" )
32
+
33
+ expect ( slave_client . get ( "key" ) ) . to be == "value"
34
34
end
35
35
end
You can’t perform that action at this time.
0 commit comments