# INSTALLATION [[email protected]]# yum -y install corosync pcs pacemaker [[email protected]]# yum -y install corosync pcs pacemaker # START PCSD [[email protected]]# systemctl start pcsd [[email protected]]# systemctl start pcsd # SET PASSWORD [[email protected]]# passwd hacluster [[email protected]]# passwd hacluster [[email protected]]# pcs cluster auth host1 host2 # START CLUSTER [[email protected]]# pcs cluster setup --name cluster_asterisk host1 host2 [[email protected]]# systemctl start pacemaker; systemctl start corosync [[email protected]]# systemctl start pacemaker; systemctl start corosync [[email protected]]# pcs cluster start --all # Disable STONITH [[email protected]]# pcs property set stonith-enabled=false [[email protected]]# pcs property set no-quorum-policy=ignore # CONFIGURE CLUSTER [[email protected]]# pcs resource create virtual_ip ocf:heartbeat:IPaddr2 \ ip=10.88.1.101 cidr_netmask=32 op monitor interval=30s on-fail=restart [[email protected]]# 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 [[email protected]]# yum install asterisk [[email protected]]# cd /usr/lib/ocf/resource.d/heartbeat; \ wget https://raw.githubusercontent.com/ClusterLabs/resource-agents\ /master/heartbeat/asterisk; \ chmod 755 asterisk [[email protected]]# 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 [[email protected]]# yum install asterisk [[email protected]]# cd /usr/lib/ocf/resource.d/heartbeat; \ wget https://raw.githubusercontent.com/ClusterLabs/resource-agents/\ master/heartbeat/asterisk; \ chmod 755 asterisk [[email protected]]# pcs resource create asterisk ocf:heartbeat:asterisk params \ user="root" group="root" op monitor timeout="30" [[email protected]]# pcs constraint colocation add asterisk with virtual_ip \ score=INFINITY [[email protected]]# pcs constraint order virtual_ip then asterisk # WITH THIS PARAMS YOU CAN MOVE RESOURCES BW NODES [[email protected]]# 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 [[email protected]]# systemctl enable pcsd; systemctl enable corosync; \ systemctl enable pacemaker [[email protected]]# 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”