Pacemaker Ubuntu 18.04 virtual box Apache2
Download Ubuntu Server 18.0-.- .iso.
https://www.osboxes.org/ubuntu-server/
Create 2 ubuntu Server (Node) and installing both
Run both server (server1, server2)
install apache first
apt-get intall -y apach2
apt-get install pacemaker corosync crmsh pcs ufw firewalld fence-agents wget policycoreutils-python-utils
Edit your hostname on both server
nano /etc/hosts
192.168.56.00 —server1 192.168.56.01 —server2
Now, check for connectivity to the outside world. Start small by testing whether we can reach the gateway we configured.
ping -c 3 server2
Check you received 3 packet from server2
nano /etc/corosync/corosync.conf
totem {
version: 2
secauth: off
cluster_name: pacemaker1
transport: udpu
}
nodelist {
node {
ring0_addr: server1
nodeid: 101
}
node {
ring0_addr: server2
nodeid: 102
}
}
quorum {
provider: corosync_votequorum
two_node: 1
wait_for_all: 1
last_man_standing: 1
auto_tie_breaker: 0
}
logging {
to_logfile: yes
logfile: /var/log/corosync/corosync.log
to_syslog: yes
timestamp: on
}
service {
name: pacemaker
ver: 1
}
EOF
nano /etc/default/corosync
START=yes
Allow cluster services through firewall both server
firewall-cmd --permanent --add-service=high-availability
firewall-cmd --reload
Enable pcs Daemon both server
systemctl start pcsd.service
systemctl enable pcsd.service
Now we will set a password for the hacluster user, using the same password on both server
passwd hacluster
Changing password for user hacluster.
New password: 12345678
pcs property set stonith-enabled=false
start pacemaker in both server
service pacemaker start
systemctl enable pcsd.service pacemaker.service corosync.service
systemctl start pcsd.service
iptables --flush
One your master server(server1) Configure Corosync
Pcs cluster auth server1 server2 -u hacluster -p 12345678 –force
Check the both server are Authorized Use pcs cluster setup on the same node to generate and synchronize the corosync Configuration
pcs cluster setup --name mycluster server1 server2 –force
Start the Cluster and To disable STONITH, set the stonith-enabled cluster option to false
pcs cluster start –all
pcs cluster status
pcs property set stonith-enabled=false
pcs property set no-quorum-policy=ignore
pcs resource defaults migration-threshold=1 --force
pcs resource create ClusterIP ocf:heartbeat:IPaddr2 ip=1.2.3.4 cidr_netmask=32 nic=lo op monitor interval=30s
pcs cluster setup --name mycluster server1 server2 –force