github.com/ghodss/etcd@v0.3.1-0.20140417172404-cc329bfa55cb/scripts/test-cluster (about) 1 #!/bin/bash -x 2 SESSION=etcd-cluster 3 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 5 ulimit -n unlimited 6 7 tmux new-session -d -s $SESSION 8 mkdir test-cluster 9 10 peer_args= 11 if [ -n "${DISCOVERY_URL}" ]; then 12 peer_args="-discovery ${DISCOVERY_URL}" 13 fi 14 15 # Setup a window for tailing log files 16 tmux new-window -t $SESSION:1 -n 'peers' 17 tmux split-window -h 18 tmux select-pane -t 0 19 tmux send-keys "${DIR}/../bin/etcd -peer-addr 127.0.0.1:7001 -addr 127.0.0.1:4001 -data-dir test-cluster/peer1 -name peer1 ${peer_args}" C-m 20 21 if [ -z "${peer_args}" ]; then 22 peer_args="-peers 127.0.0.1:7001" 23 fi 24 25 for i in 2 3; do 26 tmux select-pane -t 0 27 tmux split-window -v 28 tmux send-keys "sleep 2; ${DIR}/../bin/etcd -cors='*' -peer-addr 127.0.0.1:700${i} -addr 127.0.0.1:400${i} -data-dir test-cluster/peer${i} -name peer${i} ${peer_args}" C-m 29 done 30 31 tmux new-window -t $SESSION:2 -n 'proxy' 32 tmux split-window -h 33 tmux select-pane -t 0 34 tmux send-keys "curl -XPUT -H \"Content-Type: application/json\" -d '{\"activeSize\":3, \"promoteDelay\":30}' http://127.0.0.1:7001/v2/admin/config" C-m 35 36 for i in 4 5 6; do 37 tmux select-pane -t 0 38 tmux split-window -v 39 tmux send-keys "sleep 5; ${DIR}/../bin/etcd -cors='*' -peer-addr 127.0.0.1:700${i} -addr 127.0.0.1:400${i} -data-dir test-cluster/peer${i} -name peer${i} ${peer_args}" C-m 40 done 41 42 # Attach to session 43 tmux attach-session -t $SESSION