# INSTALLATION [root@host1]# yum -y install corosync pcs pacemaker [root@host2]# yum -y install corosync pcs pacemaker # 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_asterisk 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]# yum -y install uuid-c++ uuid-c++-devel libuuid-devel \ jansson-devel gmime gmime-devel gsm gsm-devel ilbc ilbc-devel speex \ speex-devel libogg libogg-devel libvorbis libsrtp libsrtp-devel \ libvorbis-devel [root@host1]# yum install asterisk [root@host1]# cd /usr/lib/ocf/resource.d/heartbeat; \ wget https://raw.githubusercontent.com/ClusterLabs/resource-agents\ /master/heartbeat/asterisk; \ chmod 755 asterisk [root@host2]# yum -y install uuid-c++ uuid-c++-devel libuuid-devel \ jansson-devel gmime gmime-devel gsm gsm-devel ilbc ilbc-devel speex \ speex-devel libogg libogg-devel libvorbis libsrtp libsrtp-devel \ libvorbis-devel [root@host2]# yum install asterisk [root@host2]# cd /usr/lib/ocf/resource.d/heartbeat; \ wget https://raw.githubusercontent.com/ClusterLabs/resource-agents/\ master/heartbeat/asterisk; \ chmod 755 asterisk [root@host1]# pcs resource create asterisk ocf:heartbeat:asterisk params \ user="root" group="root" op monitor timeout="30" [root@host1]# pcs constraint colocation add asterisk with virtual_ip \ score=INFINITY [root@host1]# pcs constraint order virtual_ip then asterisk # WITH THIS PARAMS YOU CAN MOVE RESOURCES BW NODES [root@host1]# pcs resource defaults resource-stickiness="0" # !!!! DON'T FORGET TO DISABLE ASTERISK IN INITD AND SYSTEMD AUTOLOAD, # OTHER WISE ASTERISK WILL BECOME UNMANAGED # SET AUTOSTART [root@host1]# systemctl enable pcsd; systemctl enable corosync; \ systemctl enable pacemaker [root@host2]# systemctl enable pcsd; systemctl enable corosync; \ systemctl enable pacemaker
How to test it?
When I disable asterisk service on both nodes, after reboot both nodes, asterisk service not start automatically in active node. I need to start the asterisk service manually. If migrate the active service to other node, current active service is stop automatically. But the asterisk service is not start automatically in new active node.
show “pcs status”