Delete utils/create-cluster/create-cluster
This commit is contained in:
parent
504316ab11
commit
24f96f3a7e
@ -1,124 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Settings
|
||||
BIN_PATH="../../src/"
|
||||
CLUSTER_HOST=127.0.0.1
|
||||
PORT=30000
|
||||
TIMEOUT=2000
|
||||
NODES=6
|
||||
REPLICAS=1
|
||||
PROTECTED_MODE=yes
|
||||
ADDITIONAL_OPTIONS=""
|
||||
|
||||
# You may want to put the above config parameters into config.sh in order to
|
||||
# override the defaults without modifying this script.
|
||||
|
||||
if [ -a config.sh ]
|
||||
then
|
||||
source "config.sh"
|
||||
fi
|
||||
|
||||
# Computed vars
|
||||
ENDPORT=$((PORT+NODES))
|
||||
|
||||
if [ "$1" == "start" ]
|
||||
then
|
||||
while [ $((PORT < ENDPORT)) != "0" ]; do
|
||||
PORT=$((PORT+1))
|
||||
echo "Starting $PORT"
|
||||
if [ "$2" == "flash" ]
|
||||
then
|
||||
ADDITIONAL_OPTIONS="--save \"\" \"\" \"\" --semi-ordered-set-bucket-size 8 --client-output-buffer-limit replica 1 1 0 --maxmemory 100000000 --storage-provider flash ./$PORT.flash"
|
||||
fi
|
||||
$BIN_PATH/keydb-server --server-threads 4 --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS}
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "create" ]
|
||||
then
|
||||
HOSTS=""
|
||||
while [ $((PORT < ENDPORT)) != "0" ]; do
|
||||
PORT=$((PORT+1))
|
||||
HOSTS="$HOSTS $CLUSTER_HOST:$PORT"
|
||||
done
|
||||
OPT_ARG=""
|
||||
if [ "$2" == "-f" ]; then
|
||||
OPT_ARG="--cluster-yes"
|
||||
fi
|
||||
$BIN_PATH/keydb-cli --cluster create $HOSTS --cluster-replicas $REPLICAS $OPT_ARG
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "stop" ]
|
||||
then
|
||||
while [ $((PORT < ENDPORT)) != "0" ]; do
|
||||
PORT=$((PORT+1))
|
||||
echo "Stopping $PORT"
|
||||
$BIN_PATH/keydb-cli -p $PORT shutdown nosave
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "watch" ]
|
||||
then
|
||||
PORT=$((PORT+1))
|
||||
while [ 1 ]; do
|
||||
clear
|
||||
date
|
||||
$BIN_PATH/keydb-cli -p $PORT cluster nodes | head -30
|
||||
sleep 1
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "tail" ]
|
||||
then
|
||||
INSTANCE=$2
|
||||
PORT=$((PORT+INSTANCE))
|
||||
tail -f ${PORT}.log
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "tailall" ]
|
||||
then
|
||||
tail -f *.log
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "call" ]
|
||||
then
|
||||
while [ $((PORT < ENDPORT)) != "0" ]; do
|
||||
PORT=$((PORT+1))
|
||||
$BIN_PATH/keydb-cli -p $PORT $2 $3 $4 $5 $6 $7 $8 $9
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "clean" ]
|
||||
then
|
||||
rm -rf *.log
|
||||
rm -rf appendonly*.aof
|
||||
rm -rf dump*.rdb
|
||||
rm -rf nodes*.conf
|
||||
rm -rf *.flash
|
||||
rm -rf temp*.rdb
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "clean-logs" ]
|
||||
then
|
||||
rm -rf *.log
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Usage: $0 [start|create|stop|watch|tail|clean|call]"
|
||||
echo "start -- Launch Redis Cluster instances."
|
||||
echo "create [-f] -- Create a cluster using keydb-cli --cluster create."
|
||||
echo "stop -- Stop Redis Cluster instances."
|
||||
echo "watch -- Show CLUSTER NODES output (first 30 lines) of first node."
|
||||
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 "clean -- Remove all instances data, logs, configs."
|
||||
echo "clean-logs -- Remove just instances logs."
|
||||
echo "call <cmd> -- Call a command (up to 7 arguments) on all nodes."
|
Loading…
x
Reference in New Issue
Block a user