-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_etcd.sh
More file actions
executable file
·46 lines (41 loc) · 1.05 KB
/
run_etcd.sh
File metadata and controls
executable file
·46 lines (41 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
rm -rf data.etcd
if [ $# -eq 0 ]
then
echo "Usage: $0 MACHINE_NUM"
exit 1
fi
TOKEN=k8sonbudget
CLUSTER_STATE=new
NAME_1=vm-116
NAME_2=vm-117
NAME_3=vm-118
HOST_1=10.140.17.116
HOST_2=10.140.17.117
HOST_3=10.140.17.118
CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380
if [ $1 -eq 1 ]
then
# For machine 1
THIS_NAME=${NAME_1}
THIS_IP=${HOST_1}
elif [ $1 -eq 2 ]
then
# For machine 2
THIS_NAME=${NAME_2}
THIS_IP=${HOST_2}
elif [ $1 -eq 3 ]
then
# For machine 3
THIS_NAME=${NAME_3}
THIS_IP=${HOST_3}
else
echo "MACHINE_NUM out of bound"
exit 1
fi
echo "Starting etcd on ${THIS_NAME} with IP ${THIS_IP}"
etcd --data-dir=data.etcd --name ${THIS_NAME} \
--initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://${THIS_IP}:2380 \
--advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://${THIS_IP}:2379 \
--initial-cluster ${CLUSTER} \
--initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN}