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
66
77EXPOSE 16379 16380 16381 16382 16383 16384
88
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
66
77EXPOSE 6372 6373 6374 6375 6376 6377
88
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 11#! /bin/bash
2+
23mkdir -p /nodes
34touch /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
719 mkdir -p /nodes/$PORT
820 if [[ -e /redis.conf ]]; then
921 cp /redis.conf /nodes/$PORT /redis.conf
@@ -17,12 +29,18 @@ daemonize yes
1729logfile /redis.log
1830dir /nodes/$PORT
1931EOF
32+
33+ set -x
2034 redis-server /nodes/$PORT /redis.conf
2135 if [ $? -ne 0 ]; then
2236 echo " Redis failed to start, exiting."
23- exit 3
37+ continue
2438 fi
2539 echo 127.0.0.1:$PORT >> /nodes/nodemap
2640done
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
2846tail -f /redis.log
You can’t perform that action at this time.
0 commit comments