Skip to content

Commit 780b790

Browse files
committed
Add script to start sentinels.
1 parent 99df7f0 commit 780b790

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Gemfile.lock
77
/.yardoc
88
/coverage/*
99
/doc/
10+
/examples/sentinel/sentinel.conf
1011
/nohup.out
1112
/pkg/*
1213
/rdsrv

examples/sentinel/sentinel.conf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
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
10+
# Generated by CONFIG REWRITE
11+
port 26379
12+
dir "/Users/jano/code/redis-rb"
13+
sentinel known-sentinel master2 127.0.0.1 26380 4748647f7aa0ad1d6a3faa978a2829e88436ddb8
14+
sentinel monitor master1 127.0.0.1 6380 2
15+
sentinel down-after-milliseconds master1 60000
16+
17+
sentinel config-epoch master1 0
18+
sentinel leader-epoch master1 0
19+
sentinel known-slave master1 127.0.0.1 63800
20+
sentinel known-slave master1 127.0.0.1 63801
21+
sentinel known-sentinel master1 127.0.0.1 26379 d2ea5375967f2b992955679c5832f0c779f50171
22+
sentinel known-sentinel master1 127.0.0.1 26380 4748647f7aa0ad1d6a3faa978a2829e88436ddb8
23+
sentinel current-epoch 0

examples/sentinel/start

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! /usr/bin/env ruby
2+
3+
at_exit do
4+
pids.each do |pid|
5+
Process.kill(:INT, pid)
6+
end
7+
8+
Process.waitall
9+
end
10+
11+
pids = []
12+
13+
# Masters
14+
pids << spawn("redis-server --port 6380")
15+
pids << spawn("redis-server --port 6381")
16+
17+
# 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")
20+
21+
# 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")
24+
25+
# Sentinels
26+
pids << spawn("redis-server sentinel/sentinel.conf --sentinel --port 26379")
27+
pids << spawn("redis-server sentinel/sentinel.conf --sentinel --port 26380")
28+
29+
Process.waitall

0 commit comments

Comments
 (0)