-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-vip.sh
126 lines (108 loc) · 3.77 KB
/
setup-vip.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
# This script needs to be run on infra1 only. Assumes ssh keys are already configured on infra{2,3}
# Use at your own risk. Do not run this without reading it first.
# There is a lot hard-coded in this script. I'm working on generalizing it, but it gives you
# an idea of what needs to happen to get the VIPs up and running on Ubuntu 16.04
INFRA1_IP="172.29.236.11"
INFRA2_IP="172.29.236.12"
INFRA3_IP="172.29.236.13"
OSA_INT_VIP_IP="172.29.239.150"
OSA_EXT_VIP_IP="172.29.239.151"
# package pre-reqs
apt install -y pacemaker crmsh corosync cluster-glue resource-agents libqb0
ssh $INFRA2_IP apt install -y pacemaker crmsh corosync cluster-glue resource-agents libqb0
ssh $INFRA3_IP apt install -y pacemaker crmsh corosync cluster-glue resource-agents libqb0
# corosync
echo "START=yes" >> /etc/default/corosync
cat << EOF > /etc/corosync/corosync.conf
totem {
version: 2
cluster_name: openstack
token: 3000
token_retransmits_before_loss_const: 10
clear_node_high_bit: yes
crypto_cipher: none
crypto_hash: none
interface {
ringnumber: 0
bindnetaddr: $INFRA1_IP
broadcast: yes (1)
mcastport: 5405
ttl: 1
}
transport: udpu (2)
}
nodelist { (3)
node {
ring0_addr: $INFRA1_IP
nodeid: 1
}
node {
ring0_addr: $INFRA2_IP
nodeid: 2
}
node {
ring0_addr: $INFRA3_IP
nodeid: 3
}
}
logging {
fileline: off
to_stderr: no
to_logfile: no
to_syslog: yes
syslog_facility: daemon
debug: off
timestamp: on
logger_subsys {
subsys: QUORUM
debug: off
}
}
quorum {
provider: corosync_votequorum
expected_votes: 2
}
EOF
service corosync restart
# generate the auth key
corosync-keygen
# setup files for infra{2,3}
sed -e 's/bindnetaddr: $INFRA1_IP/bindnetaddr: $INFRA2_IP/g' /etc/corosync/corosync.conf > /tmp/infra2.corosyn
c.conf
sed -e 's/bindnetaddr: $INFRA1_IP/bindnetaddr: $INFRA3_IP/g' /etc/corosync/corosync.conf > /tmp/infra3.corosyn
c.conf
# copy the corosync files
scp /tmp/infra2.corosync.conf $INFRA2_IP:/etc/corosync/corosync.conf
scp /tmp/infra3.corosync.conf $INFRA3_IP:/etc/corosync/corosync.conf
scp /etc/default/corosync $INFRA2_IP:/etc/default/corosync
scp /etc/default/corosync $INFRA3_IP:/etc/default/corosync
scp /etc/corosync/authkey $INFRA2_IP:/etc/corosync/authkey
scp /etc/corosync/authkey $INFRA3_IP:/etc/corosync/authkey
# restart corosync on the other nodes
ssh $INFRA2_IP service corosync restart
ssh $INFRA3_IP service corosync restart
# wait for everything to check-in. Ctrl-C out once everyone is happy
crm_mon
# configure crm
crm configure property pe-warn-series-max="1000" pe-input-series-max="1000" pe-error-series-max="1000" cluster
-recheck-interval="5min"
crm configure property stonith-enabled=false
crm_verify -L
# setup vips
crm configure primitive openstack-int-vip ocf:heartbeat:IPaddr2 params ip="$OSA_INT_VIP_IP" cidr_netmask="22" op moni
tor interval="30s"
crm configure primitive openstack-ext-vip ocf:heartbeat:IPaddr2 params ip="$OSA_EXT_VIP_IP" cidr_netmask="22" op moni
tor interval="30s"
# move the vips to their preferred infra nodes (optional)
crm resource move openstack-int-vip infra2
crm resource move openstack-ext-vip infra3
# check config
crm_mon
# other openstack stuff...not in use yet
#cd /usr/lib/ocf/resource.d/
#mkdir openstack
#cd openstack
#wget https://raw.github.com/leseb/keystone/ha/tools/ocf/keystone
#wget https://raw.github.com/madkiss/glance/ha/tools/ocf/glance-registry
#wget https://raw.github.com/madkiss/glance/ha/tools/ocf/glance-api