Asterisk Cluster on CentOS

From KlavoWiki
Revision as of 02:21, 7 August 2015 by David (Sọ̀rọ̀ | contribs) (Created page with "I have completed the following using CentOS 7.1 and Asterisk 13.4.0 = Firewall = Disable firewall or allow the required ports manually. See Firewall_for_Linux <br> = The...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

I have completed the following using CentOS 7.1 and Asterisk 13.4.0

Firewall

Disable firewall or allow the required ports manually. See Firewall_for_Linux

The Cluster

The following needs to be done on both servers.

Install Cluster Apps

yum -y install corosync pcs pacemaker
systemctl enable pcsd
systemctl enable corosync
systemctl enable pacemaker
systemctl start pcsd

Create Cluster User

Use a 30 plus character random password.

passwd hacluster

Install Asterisk resource agent

wget https://raw.githubusercontent.com/ClusterLabs/resource-agents/master/heartbeat/asterisk -O /usr/lib/ocf/resource.d/heartbeat/asterisk
chmod +x /usr/lib/ocf/resource.d/heartbeat/asterisk

Configure Cluster

The following is only required on a single server as it will be replicated across your cluster.

Bind Servers

The first command will use the username and password of the user account hacluster as created above.

pcs cluster auth srv1.myserve.com srv2.myserver.com
pcs cluster setup --name pbx-cluster srv1.myserve.com srv2.myserver.com
pcs cluster start --all
pcs property set stonith-enabled=false
pcs property set no-quorum-policy=ignore

This is creating a clustered IP address of 192.168.25.30

pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.25.30 cidr_netmask=32 op monitor interval=30s

Install Asterisk

Refer to Asterisk_Install if you are not sure how.

Create Asterisk Cluster

pcs resource create asterisk ocf:heartbeat:asterisk params user="root" group="root" op monitor timeout="30"
pcs constraint colocation add asterisk with virtual_ip score=INFINITY
pcs constraint order virtual_ip then asterisk

Tools

Status

pcs status
pcs status cluster
pcs status nodes

Other Details

corosync-cmapctl | grep members
pcs status corosync
pcs property

Stop/Start a Single Node

pcs cluster stop srv2.myserver.com
pcs cluster start srv2.myserver.com