1
OpenStack Controller HA
Arif Ali edited this page 2014-10-16 01:26:19 +01:00

Prepare the 2 nodes

change the password for hacluster

passwd hacluster

Enable pcsd on the machines

systemctl start pcsd.service
systemctl enable pcsd.service

Enable authentication between the 2 nodes

pcs cluster auth stack01 stack02

DRBD Configuration

We need to make sure that the drbd rpms with the drbd pacemaker files included. These are commonly available in elrepo

cat > /etc/drbd.d/mysql.res << EOF 
resource mysql {
  device minor 0;
  disk /dev/system/mysql;
  meta-disk internal;
  net {
    verify-alg sha1;
    after-sb-0pri discard-least-changes;
    after-sb-1pri consensus;
    after-sb-2pri call-pri-lost-after-sb;
  }
  on stack01 {
    address 10.0.0.1:7789;
  }
  on stack02 {
    address 10.0.0.2:7789;
  }
}
EOF

cat > /etc/drbd.d/rabbitmq.res << EOF 
resource rabbitmq {
  device minor 1;
  disk /dev/system/rabbitmq;
  meta-disk internal;
  net {
    verify-alg sha1;
    after-sb-0pri discard-least-changes;
    after-sb-1pri consensus;
    after-sb-2pri call-pri-lost-after-sb;
  }
  on stack01 {
    address 10.0.0.1:7790;
  }
  on stack02 {
    address 10.0.0.2:7790;
  }
}
EOF

The following commands will at first only needed to be done on one of the nodes

lvcreate -L 40G -n mysql system
lvcreate -L 30G -n rabbitmq system

dd if=/dev/zero of=/dev/system/mysql count=5 bs=1M
drbdadm create-md mysql

dd if=/dev/zero of=/dev/system/rabbitmq count=5 bs=1M
drbdadm create-md rabbitmq

service drbd start
drbdadm primary --force mysql
drbdadm primary --force rabbitmq

drbdadm disk-options --resync-rate=110M mysql
drbdadm disk-options --resync-rate=110M rabbitmq

mkfs -t xfs /dev/drbd/by-res/mysql
mkfs -t xfs /dev/drbd/by-res/rabbitmq
pcs cluster cib stack-cfg

pcs -f stack-cfg stonith stack01-ipmi fence_ipmilan params ipaddr=10.0.1.1 \
   passwd=PASSW0RD login=USERID pcmk_host_list=stack01 \
   pcmk_host_check=static-list action=monitor
pcs -f stack-cfg stonith stack02-ipmi fence_ipmilan params ipaddr=10.0.1.2 \
   passwd=PASSW0RD login=USERID pcmk_host_list=stack02 \
   pcmk_host_check=static-list action=monitor
pcs -f stack-cfg property stonith-enabled=true

pcs cluster cib-push stack-cfg 
pcs cluster cib stack-cfg

pcs -f stack-cfg property no-quorum-policy="ignore"
pcs -f stack-cfg property pe-warn-series-max="10000"
pcs -f stack-cfg property pe-input-series-max="10000"
pcs -f stack-cfg property pe-error-series-max="10000"
pcs -f stack-cfg property cluster-recheck-interval="5min"

pcs cluster cib-push stack-cfg 
pcs cluster cib stack-cfg

pcs -f stack-cfg resource create ip_db ocf:heartbeat:IPaddr2 \
   ip="10.0.0.252" iflabel="mysql" cidr_netmask="23"

pcs -f stack-cfg resource create drbd_mysql ocf:linbit:drbd \
   drbd_resource=mysql
pcs -f stack-cfg resource master ms_drbd_mysql drbd_mysql \
   master-max="1" master-node-max="1" clone-max="2" \
   clone-node-max="1" notify="true"
pcs -f stack-cfg resource create fs_mysql ocf:heartbeat:Filesystem \
   device="/dev/drbd/by-res/mysql" directory="/var/lib/mysql" fstype="xfs"
pcs -f stack-cfg resource create db_stack ocf:heartbeat:mysql config="/etc/my.cnf" \
   pid="/var/run/mariadb/mariadb.pid" socket="/var/lib/mysql/mysql.sock" \
   log="/var/log/mariadb/mariadb.log"

pcs -f stack-cfg resource group add grp_mysql ip_db fs_mysql db_stack

pcs -f stack-cfg constraint colocation add grp_mysql ms_drbd_mysql INFINITY with-rsc-role=Master

pcs -f stack-cfg constraint order promote ms_drbd_mysql then start grp_mysql

pcs -f stack-cfg resource create ip_rabbitmq ocf:heartbeat:IPaddr2 \
   ip="10.0.0.253" iflabel="rabbitmq" cidr_netmask="23"

pcs -f stack-cfg resource create drbd_rabbitmq ocf:linbit:drbd \
   drbd_resource=rabbitmq
pcs -f stack-cfg resource master ms_drbd_rabbitmq drbd_rabbitmq \
   master-max="1" master-node-max="1" clone-max="2" \
   clone-node-max="1" notify="true"
pcs -f stack-cfg resource create fs_rabbitmq ocf:heartbeat:Filesystem \
   device="/dev/drbd/by-res/rabbitmq" directory="/var/lib/rabbitmq" fstype="xfs"
pcs -f stack-cfg resource create rabbitmq ocf:rabbitmq:rabbitmq \
   nodename="rabbit@localhost" mnesia_base="/var/lib/rabbitmq"

pcs -f stack-cfg resource group add grp_rabbitmq ip_rabbitmq fs_rabbitmq rabbitmq

pcs -f stack-cfg constraint colocation add grp_rabbitmq ms_drbd_rabbitmq INFINITY with-rsc-role=Master

pcs -f stack-cfg constraint order promote ms_drbd_rabbitmq then start grp_rabbitmq

pcs -f stack-cfg resource create ip_api ocf:heartbeat:IPaddr2 \
   ip="10.0.0.254" iflabel="api" cidr_netmask="23"

pcs cluster cib-push stack-cfg