Skip to content

Commit ea6f6f0

Browse files
committed
cluster script now accepts ports
1 parent 97e1d89 commit ea6f6f0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

docker/base/Dockerfile.cluster

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ RUN chmod +x /create_cluster.sh
66

77
EXPOSE 16379 16380 16381 16382 16383 16384
88

9-
CMD [ "/create_cluster.sh"]
9+
CMD /create_cluster.sh 16379 16384

docker/base/Dockerfile.unstable_cluster

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ RUN chmod +x /create_cluster.sh
66

77
EXPOSE 6372 6373 6374 6375 6376 6377
88

9-
CMD [ "/create_cluster.sh"]
9+
CMD /create_cluster.sh 6372 6377

docker/base/create_cluster.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#! /bin/bash
22
mkdir -p /nodes
33
touch /nodes/nodemap
4-
for PORT in $(seq 16379 16384); do
4+
START_NODE=$1
5+
END_NODE=$2
6+
for PORT in `seq ${START_NODE} ${END_NODE}`; do
57
mkdir -p /nodes/$PORT
68
if [[ -e /redis.conf ]]; then
79
cp /redis.conf /nodes/$PORT/redis.conf
@@ -22,5 +24,5 @@ EOF
2224
fi
2325
echo 127.0.0.1:$PORT >> /nodes/nodemap
2426
done
25-
echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g 16379 16384) --cluster-replicas 1
27+
echo yes | redis-cli --cluster create $(seq -f 127.0.0.1:%g ${START_NODE} ${END_NODE}) --cluster-replicas 1
2628
tail -f /redis.log

0 commit comments

Comments
 (0)