Adds BIN_PATH to create-cluster

Allows for setting the binaries path if used outside the upstream repo.

Also documents `call` in usage clause (TODO: port to
`redis-cli --cluster call` or just deprecate it).
This commit is contained in:
Itamar Haber 2020-02-28 13:35:10 +02:00 committed by antirez
parent b712fba17c
commit cac9d7cf7e

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# Settings # Settings
BIN_PATH="../../"
CLUSTER_HOST=127.0.0.1 CLUSTER_HOST=127.0.0.1
PORT=30000 PORT=30000
TIMEOUT=2000 TIMEOUT=2000
@ -25,7 +26,7 @@ then
while [ $((PORT < ENDPORT)) != "0" ]; do while [ $((PORT < ENDPORT)) != "0" ]; do
PORT=$((PORT+1)) PORT=$((PORT+1))
echo "Starting $PORT" echo "Starting $PORT"
../../src/redis-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS} $BIN_PATH/redis-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS}
done done
exit 0 exit 0
fi fi
@ -37,7 +38,7 @@ then
PORT=$((PORT+1)) PORT=$((PORT+1))
HOSTS="$HOSTS $CLUSTER_HOST:$PORT" HOSTS="$HOSTS $CLUSTER_HOST:$PORT"
done done
../../src/redis-cli --cluster create $HOSTS --cluster-replicas $REPLICAS $BIN_PATH/redis-cli --cluster create $HOSTS --cluster-replicas $REPLICAS
exit 0 exit 0
fi fi
@ -46,7 +47,7 @@ then
while [ $((PORT < ENDPORT)) != "0" ]; do while [ $((PORT < ENDPORT)) != "0" ]; do
PORT=$((PORT+1)) PORT=$((PORT+1))
echo "Stopping $PORT" echo "Stopping $PORT"
../../src/redis-cli -p $PORT shutdown nosave $BIN_PATH/redis-cli -p $PORT shutdown nosave
done done
exit 0 exit 0
fi fi
@ -57,7 +58,7 @@ then
while [ 1 ]; do while [ 1 ]; do
clear clear
date date
../../src/redis-cli -p $PORT cluster nodes | head -30 $BIN_PATH/redis-cli -p $PORT cluster nodes | head -30
sleep 1 sleep 1
done done
exit 0 exit 0
@ -81,7 +82,7 @@ if [ "$1" == "call" ]
then then
while [ $((PORT < ENDPORT)) != "0" ]; do while [ $((PORT < ENDPORT)) != "0" ]; do
PORT=$((PORT+1)) PORT=$((PORT+1))
../../src/redis-cli -p $PORT $2 $3 $4 $5 $6 $7 $8 $9 $BIN_PATH/redis-cli -p $PORT $2 $3 $4 $5 $6 $7 $8 $9
done done
exit 0 exit 0
fi fi
@ -101,7 +102,7 @@ then
exit 0 exit 0
fi fi
echo "Usage: $0 [start|create|stop|watch|tail|clean]" echo "Usage: $0 [start|create|stop|watch|tail|clean|call]"
echo "start -- Launch Redis Cluster instances." echo "start -- Launch Redis Cluster instances."
echo "create -- Create a cluster using redis-cli --cluster create." echo "create -- Create a cluster using redis-cli --cluster create."
echo "stop -- Stop Redis Cluster instances." echo "stop -- Stop Redis Cluster instances."
@ -110,3 +111,4 @@ echo "tail <id> -- Run tail -f of instance at base port + ID."
echo "tailall -- Run tail -f for all the log files at once." echo "tailall -- Run tail -f for all the log files at once."
echo "clean -- Remove all instances data, logs, configs." echo "clean -- Remove all instances data, logs, configs."
echo "clean-logs -- Remove just instances logs." echo "clean-logs -- Remove just instances logs."
echo "call <cmd> -- Call a command (up to 7 arguments) on all nodes. "