File tree Expand file tree Collapse file tree 4 files changed +46
-7
lines changed Expand file tree Collapse file tree 4 files changed +46
-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
+ # produces redisfab/redis-py-sentinel:unstable
2
+ FROM ubuntu:bionic as builder
3
+ RUN apt-get update
4
+ RUN apt-get upgrade -y
5
+ RUN apt-get install -y build-essential git
6
+ RUN mkdir /build
7
+ WORKDIR /build
8
+ RUN git clone https://github.com/redis/redis
9
+ WORKDIR /build/redis
10
+ RUN make
11
+
12
+ FROM ubuntu:bionic as runner
13
+ COPY --from=builder /build/redis/src/redis-server /usr/bin/redis-server
14
+ COPY --from=builder /build/redis/src/redis-cli /usr/bin/redis-cli
15
+ COPY --from=builder /build/redis/src/redis-sentinel /usr/bin/redis-sentinel
16
+
17
+ CMD ["redis-sentinel", "/sentinel.conf"]
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,18 @@ 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
+ if [ -z " ${REDIS_PASSWORD} " ]; then
42
+ echo yes | redis-cli --cluster create ` seq -f 127.0.0.1:%g ${START_PORT} ${END_PORT} ` --cluster-replicas 1
43
+ else
44
+ echo yes | redis-cli -a ${REDIS_PASSWORD} --cluster create ` seq -f 127.0.0.1:%g ${START_PORT} ${END_PORT} ` --cluster-replicas 1
45
+ fi
28
46
tail -f /redis.log
You can’t perform that action at this time.
0 commit comments