update etcd-multi-nodes.sh

This commit is contained in:
zhongyh16 2017-05-15 16:16:15 +08:00
parent 2d51406fdd
commit 1f38e62421
1 changed files with 7 additions and 5 deletions

View File

@ -5,13 +5,15 @@
which etcd &>/dev/null || { echo "etcd not installed, please install etcd first" && exit 1; }
if [ $# -eq 0 ] ; then
echo "Usage: `basename $0` index ip1 ip2 ip3"
echo "Usage: `basename $0` index selfip ip1 ip2 ip3"
echo " ip1 ip2 ip3 are the ip address of node etcd_1 etcd_2 etcd_3"
exit 1
fi
etcdindex=etcd_$1
shift
selfip=$1
shift
etcd_1=$1
index=1
while [ $# -gt 0 ] ; do
@ -40,10 +42,10 @@ tempdir=/opt/docklet/local
[ ! -d $tempdir/run ] && mkdir -p $tempdir/run
etcd --name $etcdindex \
--initial-advertise-peer-urls http://$etcdindex:2380 \
--listen-peer-urls http://$etcdindex:2380 \
--listen-client-urls http://$etcdindex:2379 \
--advertise-client-urls http://$etcdindex:2379 \
--initial-advertise-peer-urls http://$selfip:2380 \
--listen-peer-urls http://$selfip:2380 \
--listen-client-urls http://$selfip:2379 \
--advertise-client-urls http://$selfip:2379 \
--initial-cluster-token etcd-cluster \
--initial-cluster $CLUSTER \
--initial-cluster-state new