This is a giant cleanup of the etcd code. The earlier version was written when I was less experienced with golang. This is still not perfect, and does contain some races, but at least it's a decent base to start from. The automatic elastic clustering should be considered an experimental feature. If you need a more battle-tested cluster, then you should manage etcd manually and point mgmt at your existing cluster.
36 lines
975 B
Bash
Executable File
36 lines
975 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
. "$(dirname "$0")/../util.sh"
|
|
|
|
# run empty graphs, we're just testing etcd clustering
|
|
$TIMEOUT "$MGMT" run --hostname h1 --tmp-prefix empty &
|
|
pid1=$!
|
|
sleep 15s # let it startup
|
|
|
|
$TIMEOUT "$MGMT" run --hostname h2 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2381 --server-urls http://127.0.0.1:2382 --tmp-prefix empty &
|
|
pid2=$!
|
|
sleep 15s
|
|
|
|
$TIMEOUT "$MGMT" run --hostname h3 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2383 --server-urls http://127.0.0.1:2384 --tmp-prefix empty &
|
|
pid3=$!
|
|
sleep 15s
|
|
|
|
$(sleep 15s && kill -SIGINT $pid1)& # send ^C to exit 1st mgmt (reversed!)
|
|
wait $pid1
|
|
e=$?
|
|
if [ $e -ne 0 ]; then
|
|
exit $e
|
|
fi
|
|
|
|
$(sleep 15s && kill -SIGINT $pid2)& # send ^C to exit 2nd mgmt
|
|
wait $pid2
|
|
e=$?
|
|
if [ $e -ne 0 ]; then
|
|
exit $e
|
|
fi
|
|
|
|
$(sleep 15s && kill -SIGINT $pid3)& # send ^C to exit 3rd mgmt (reversed!)
|
|
wait $pid3 # get exit status
|
|
# if pid3 exits because of a timeout, then it blocked, and this is a bug!
|
|
exit $?
|