====== How to Use Script Configure High Available and Cluster ====== High Available(HA):There are two servers of asterCC,master server runs all service(PBX,CTI,WEB,DATABASE) via virtual IP,the secondary server that can take over virtual IP from the master,it will work via virtual IP when the master is shutdown according to detecting the master by heartbeat IP。 ===== The Configuration of Master/Slave Server ===== ==== Information of Sample ==== **Master Server**: Service IP:192.168.1.120(Used in trunk and device registration) eth0:192.168.1.234,this is primary IP of master server eth0:1 ,the name of virtual NIC,it is disabled default eth1:10.10.10.1,the heartbeat IP **Slave Server**: eth0:192.168.1.235,this is primary IP of slave server eth0:1 ,the name of virtual NIC,it is disabled default eth1:10.10.10.2,the heartbeat IP ==== The Script file:clusterconf.sh ==== After configuring eth0 and IP,and finish the installation of AsterCC,then you should download and send the "identity" to support@astercc.org for obtaining authorization.We will configure them through clusterconf.sh. First,copy /opt/asterisk/scripts/astercc/clusterconf.sh to /root/ directory: cp /opt/asterisk/scripts/astercc/clusterconf.sh /root Enter /root directory,and execute commands as shown below: cd /root chmod +x ./clustercc.sh Select the type of configuration,input 1 means "HA",as shown below: {{:en:faq:ha_and_cluster01.png?600|}} Configure detailed parameters after press "Enter",as shown below: {{:en:faq:ha_and_cluster02.png?700|}} Input the parameters as the prompt of script above,press "y" if you confirm parameters above. {{:en:faq:ha_and_cluster03.png?700|}} You will enter next step after inputing "yes" and the password of slave server twice,script continues to run automatically: {{:en:faq:ha_and_cluster04.png?700|}} {{:en:faq:ha_and_cluster05.png?700|}} When script is finished,you should log on and shutdown the slave server,execute commands as shown below: shutdown -h now Then reboot the slave server after the master server is restarted completely: reboot ==== Checking Database Configuration ==== You should log on two database servers separately,execute commands as shown below: show slave status \G; As shown below,the values of "Slave_IO_Running" and "Slave_SQL_Running" are "Yes",and others are normal.It is demonstrated the synchronization of database is available. {{:en:faq:ha_and_cluster06.png?700|}} ==== Checking Configuration of Files Synchronization ==== Execute commands as shown below on Master server first: cd /home/ccsync && touch abc Second verify the "abc" file existed or not(maybe there is a few seconds delay): ls /home/ccsync/abc And then,remove the "abc" file on master server,and check the file whether was also deleted in slave server. rm /home/ccsync/abc Last,test function of switching between master and slave server. ===== The Configuration of Cluster ===== Cluster:At least three servers running simultaneously,the master server run all services,include:PBX,CTI,database,WebService,slave server will run PBX,CTI,database backup,others run PBX and CTI.Although all of the servers run PBX and CTI simultaneously,they use one database,and same configuration of PBX and CTI.We can operate on master server,the database and web services supported to other servers via a virtual IP.The slave server will take over database and web services from master when master is abnormal. ==== Information of Sample ==== **Master Server**: eth0:Service IP:192.168.1.234 (Used in trunk and device registration). eth0:1,the name of virtual NIC,this is primary IP of master server:192.168.1.120(used in database and web services). eth1:10.10.10.1,the heartbeat IP. **Slave Server(backup server)**: eth0:192.168.1.235 ,the primary IP of PBX service(Used in trunk and device registration). eth0:1,the name of virtual NIC,it is disabled default. eth1:10.10.10.2,the heartbeat IP. **Cluster Server**: eth1:192.168.1.245,the NIC of PBX service. ==== The Script file:clusterconf.sh ==== After configuring eth0 and IP,and finish the installation of AsterCC,then you should download and send the "identity" to support@astercc.org for obtaining authorization.We will configure them through clusterconf.sh. First,copy /opt/asterisk/scripts/astercc/clusterconf.sh to /root/ directory: cp /opt/asterisk/scripts/astercc/clusterconf.sh /root Enter /root directory,and execute commands as shown below: cd /root chmod +x ./clustercc.sh {{:en:faq:ha_and_cluster07.png?700|}} Select the type of configuration,input 2 means "Cluster",as shown above: {{:en:faq:ha_and_cluster08.png?700|}} Input the parameters as the prompt of script above,press "y" and "Enter" if you confirm parameters above.Then,you will enter next step after inputing "yes" and the password of slave server twice,script continues to run automatically: {{:en:faq:ha_and_cluster09.png?700|}} Press "Enter" after inputting the possword of slave server twice,as shown below: {{:en:faq:ha_and_cluster010.png?700|}} {{:en:faq:ha_and_cluster011.png?700|}} Press "Enter" to continue the configuration automatically,as shown below: {{:en:faq:ha_and_cluster012.png?700|}} {{:en:faq:ha_and_cluster013.png?700|}} So far,the configuration is finished.After the script is finished,log and shutdown the slave server and other servers that running PBX service only: shutdown -h now And then reboot the master server,execute command as shown below: reboot Then poweron the slave server and other servers after the master server is restarted completely. ==== Checking Database Configuration ==== You should log on two database servers separately,execute commands as shown below: show slave status \G; As shown below,the values of "Slave_IO_Running" and "Slave_SQL_Running" are "Yes",and others are normal.It is demonstrated the synchronization of database is available. {{:en:faq:ha_and_cluster014.png?700|}} ==== Checking Configuration of Files Synchronization ==== Execute commands as shown below on Master server first: cd /home/ccsync Second verify that the "abc" existed or not(maybe there is a few seconds delay): ls /home/ccsync/abc And then,remove the "abc" file on master server,and check the file whether was also deleted in slave server. rm /home/ccsync/abc Last,test function of switching between master and slave server.