mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

Change log: 1. PeerServer - estimate initial mode from its log through removedInLog variable - refactor FindCluster to return the estimation - refactor Start to call FindCluster explicitly - move raftServer start and cluster init from FindCluster to Start - remove stopNotify from PeerServer because it is not used anymore 2. Etcd - refactor Run logic to fit the specification 3. ClusterConfig - rename promoteDelay to removeDelay for better naming - add SyncClusterInterval field to ClusterConfig - commit command to set default cluster config when cluster is created - store cluster config info into key space for consistency - reload cluster config when reboot 4. add StandbyServer 5. Error - remove unused EcodePromoteError
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/bash -x
|
|
SESSION=etcd-cluster
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
ulimit -n unlimited
|
|
|
|
tmux new-session -d -s $SESSION
|
|
mkdir test-cluster
|
|
|
|
peer_args=
|
|
if [ -n "${DISCOVERY_URL}" ]; then
|
|
peer_args="-discovery ${DISCOVERY_URL}"
|
|
fi
|
|
|
|
# Setup a window for tailing log files
|
|
tmux new-window -t $SESSION:1 -n 'peers'
|
|
tmux split-window -h
|
|
tmux select-pane -t 0
|
|
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
|
|
|
|
if [ -z "${peer_args}" ]; then
|
|
peer_args="-peers 127.0.0.1:7001"
|
|
fi
|
|
|
|
for i in 2 3; do
|
|
tmux select-pane -t 0
|
|
tmux split-window -v
|
|
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
|
|
done
|
|
|
|
tmux new-window -t $SESSION:2 -n 'proxy'
|
|
tmux split-window -h
|
|
tmux select-pane -t 0
|
|
tmux send-keys "curl -XPUT -H \"Content-Type: application/json\" -d '{\"activeSize\":3, \"removeDelay\":30}' http://127.0.0.1:7001/v2/admin/config" C-m
|
|
|
|
for i in 4 5 6; do
|
|
tmux select-pane -t 0
|
|
tmux split-window -v
|
|
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
|
|
done
|
|
|
|
# Attach to session
|
|
tmux attach-session -t $SESSION
|