Last active
April 14, 2016 08:39
-
-
Save hbprotoss/6271004e1f9da186c54ed58acd8d2d8c to your computer and use it in GitHub Desktop.
redis cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
START_PORT=7100 | |
COUNT=6 | |
for port in $(seq $START_PORT `expr $START_PORT + $COUNT - 1`) | |
do | |
dir="`pwd`/$port" | |
mkdir $dir | |
conf_file="$dir/$port.conf" | |
cat > $conf_file << EOF | |
daemonize yes | |
cluster-enabled yes | |
cluster-config-file nodes.conf | |
cluster-node-timeout 5000 | |
pidfile $port.pid | |
port $port | |
logfile "$dir/$port.log" | |
dbfilename $port.rdb | |
dir $dir | |
appendonly yes | |
appendfilename "$port.aof" | |
EOF | |
done | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
START_PORT=7100 | |
COUNT=6 | |
nodes="" | |
for port in $(seq $START_PORT `expr $START_PORT + $COUNT - 1`) | |
do | |
nodes+=" 127.0.0.1:$port" | |
redis-server "$port/$port.conf" | |
done | |
nodes=${nodes:1} | |
redis-trib.rb create --replicas 1 $nodes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
START_PORT=7100 | |
COUNT=6 | |
for port in $(seq $START_PORT `expr $START_PORT + $COUNT - 1`) | |
do | |
redis-cli -p $port shutdown | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment