File tree Expand file tree Collapse file tree 3 files changed +25
-7
lines changed Expand file tree Collapse file tree 3 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,6 @@ RUN chmod +x /create_cluster.sh
6
6
7
7
EXPOSE 16379 16380 16381 16382 16383 16384
8
8
9
- CMD /create_cluster.sh 16379 16384
9
+ ENV START_PORT=16379
10
+ ENV END_PORT=16384
11
+ CMD /create_cluster.sh
Original file line number Diff line number Diff line change @@ -6,4 +6,6 @@ RUN chmod +x /create_cluster.sh
6
6
7
7
EXPOSE 6372 6373 6374 6375 6376 6377
8
8
9
- CMD /create_cluster.sh 6372 6377
9
+ ENV START_PORT=6372
10
+ ENV END_PORT=6377
11
+ CMD ["/create_cluster.sh"]
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
+
2
3
mkdir -p /nodes
3
4
touch /nodes/nodemap
4
- START_NODE=$1
5
- END_NODE=$2
6
- for PORT in ` seq ${START_NODE} ${END_NODE} ` ; do
5
+ if [ -z ${START_PORT} ]; then
6
+ START_PORT=16379
7
+ fi
8
+ if [ -z ${END_PORT} ]; then
9
+ END_PORT=16384
10
+ fi
11
+ if [ ! -z " $3 " ]; then
12
+ START_PORT=$2
13
+ START_PORT=$3
14
+ fi
15
+ echo " STARTING: ${START_PORT} "
16
+ echo " ENDING: ${END_PORT} "
17
+
18
+ for PORT in ` seq ${START_PORT} ${END_PORT} ` ; do
7
19
mkdir -p /nodes/$PORT
8
20
if [[ -e /redis.conf ]]; then
9
21
cp /redis.conf /nodes/$PORT /redis.conf
@@ -17,12 +29,14 @@ daemonize yes
17
29
logfile /redis.log
18
30
dir /nodes/$PORT
19
31
EOF
32
+
33
+ set -x
20
34
redis-server /nodes/$PORT /redis.conf
21
35
if [ $? -ne 0 ]; then
22
36
echo " Redis failed to start, exiting."
23
- exit 3
37
+ continue
24
38
fi
25
39
echo 127.0.0.1:$PORT >> /nodes/nodemap
26
40
done
27
- echo yes | redis-cli --cluster create $( seq -f 127.0.0.1:%g ${START_NODE } ${END_NODE } ) --cluster-replicas 1
41
+ echo yes | redis-cli --cluster create $( seq -f 127.0.0.1:%g ${START_PORT } ${END_PORT } ) --cluster-replicas 1
28
42
tail -f /redis.log
You can’t perform that action at this time.
0 commit comments