# INSTALLATION [root@host1]# yum -y install corosync pcs pacemaker [root@host2]# yum -y install corosync pcs pacemaker # INSTALL MARIADB AND CREATE DEFAULT DIRECTORY [root@host1]# yum -y install mariadb-server; systemctl start mariadb; \ systemctl stop mariadb [root@host2]# yum -y install mariadb-server; systemctl start mariadb; \ systemctl stop mariadb # START PCSD [root@host1]# systemctl start pcsd [root@host2]# systemctl start pcsd # SET PASSWORD [root@host1]# passwd hacluster [root@host2]# passwd hacluster [root@host1]# pcs cluster auth host1 host2 # START CLUSTER [root@host1]# pcs cluster setup --name cluster_mysql host1 host2 [root@host1]# systemctl start pacemaker; systemctl start corosync [root@host2]# systemctl start pacemaker; systemctl start corosync [root@host1]# pcs cluster start --all # Disable STONITH [root@host1]# pcs property set stonith-enabled=false [root@host1]# pcs property set no-quorum-policy=ignore # CONFIGURE CLUSTER [root@host1]# pcs resource create virtual_ip ocf:heartbeat:IPaddr2 \ ip=10.88.1.101 cidr_netmask=32 op monitor interval=30s on-fail=restart [root@host1]# pcs resource create mysql ocf:heartbeat:mysql \ binary="/usr/bin/mysqld_safe" config="/etc/my.cnf" \ datadir="/var/lib/mysql" pid="/var/lib/mysql/mysql.pid" \ socket="/var/lib/mysql/mysql.sock" \ additional_parameters="--bind-address=0.0.0.0" op start timeout=60s \ op stop timeout=60s op monitor interval=20s timeout=30s \ on-fail=standby [root@host1]# pcs resource clone mysql clone-max=2 clone-node-max=1 # SET AUTOSTART [root@host1]# systemctl enable pcsd; systemctl enable corosync; \ systemctl enable pacemaker [root@host2]# systemctl enable pcsd; systemctl enable corosync; \ systemctl enable pacemaker # YOU SHOULD CONFIGURE MASTER MASTER REPLICATION BETWEEN 2 MYSQL SERVERS