Skip to content

Instantly share code, notes, and snippets.

@ksato9700
Created April 20, 2014 04:15
Show Gist options
  • Save ksato9700/11104810 to your computer and use it in GitHub Desktop.
Save ksato9700/11104810 to your computer and use it in GitHub Desktop.
#!/bin/bash
index=$1
HOST=127.0.0.1
PR_PORT=$(expr 7000 + $index)
MY_PORT=$(expr 4000 + $index)
if [ $index -gt 1 ]
then
PEERS="-peers "
for i in $(seq 2 $index)
do
PEERS="$PEERS $HOST:$(expr $PR_PORT - $i + 1)"
done
fi
MACHINE_NAME=machine$index
./bin/etcd \
-peer-addr $HOST:$PR_PORT \
-addr $HOST:$MY_PORT \
-data-dir machines/$MACHINE_NAME\
-name $MACHINE_NAME \
$PEERS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment