File tree Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Original file line number Diff line number Diff line change
1
+ sentinel monitor master1 127.0.0.1 6380 2
1
2
sentinel monitor master2 127.0.0.1 6381 2
2
- sentinel down-after-milliseconds master2 10000
3
- sentinel parallel-syncs master2 5
4
- sentinel config-epoch master2 0
5
-
6
- sentinel leader-epoch master2 0
7
- sentinel known-slave master2 127.0.0.1 63810
8
- sentinel known-slave master2 127.0.0.1 63801
9
- sentinel known-sentinel master2 127.0.0.1 26379 d2ea5375967f2b992955679c5832f0c779f50171
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env ruby
2
2
3
+ require "fileutils"
4
+
5
+ $pids = [ ]
6
+
3
7
at_exit do
4
- pids . each do |pid |
8
+ $ pids. each do |pid |
5
9
Process . kill ( :INT , pid )
6
10
end
7
11
8
12
Process . waitall
9
13
end
10
14
11
- pids = [ ]
15
+ base = File . expand_path ( File . dirname ( __FILE__ ) )
12
16
13
17
# Masters
14
- pids << spawn ( "redis-server --port 6380" )
15
- pids << spawn ( "redis-server --port 6381" )
18
+ $ pids << spawn ( "redis-server --port 6380" )
19
+ $ pids << spawn ( "redis-server --port 6381" )
16
20
17
21
# Slaves of Master 1
18
- pids << spawn ( "redis-server --port 63800 --slaveof 127.0.0.1 6380" )
19
- pids << spawn ( "redis-server --port 63801 --slaveof 127.0.0.1 6380" )
22
+ $ pids << spawn ( "redis-server --port 63800 --slaveof 127.0.0.1 6380" )
23
+ $ pids << spawn ( "redis-server --port 63801 --slaveof 127.0.0.1 6380" )
20
24
21
25
# Slaves of Master 2
22
- pids << spawn ( "redis-server --port 63810 --slaveof 127.0.0.1 6381" )
23
- pids << spawn ( "redis-server --port 63811 --slaveof 127.0.0.1 6381" )
26
+ $pids << spawn ( "redis-server --port 63810 --slaveof 127.0.0.1 6381" )
27
+ $pids << spawn ( "redis-server --port 63811 --slaveof 127.0.0.1 6381" )
28
+
29
+ FileUtils . cp ( File . join ( base , "sentinel.conf" ) , "tmp/sentinel1.conf" )
30
+ FileUtils . cp ( File . join ( base , "sentinel.conf" ) , "tmp/sentinel2.conf" )
24
31
25
32
# Sentinels
26
- pids << spawn ( "redis-server sentinel/sentinel .conf --sentinel --port 26379" )
27
- pids << spawn ( "redis-server sentinel/sentinel .conf --sentinel --port 26380" )
33
+ $ pids << spawn ( "redis-server tmp/sentinel1 .conf --sentinel --port 26379" )
34
+ $ pids << spawn ( "redis-server tmp/sentinel2 .conf --sentinel --port 26380" )
28
35
29
36
Process . waitall
You can’t perform that action at this time.
0 commit comments