The ScopTEL IP PBX supports different methods for
High Availability and replication of MySQL databases; this article will
explain the easiest way to configure two (2) servers in a Main / Main Server (Circular) scenario using RSYNC to synchronize Asterisk and /tftpboot directories.
We will show how to replicate the configuration, voicemail, and prompts from the Master with the IP address 192.168.192.79 to a Backup (192.168.192.60) using a Floating IP Address (192.168.192.50 /24).
Both servers must use the ScopServ installation disk (ISO). The image is available to download at http://download.scopserv.com/iso/
You must absolutely use version scopserv-server-18.104.22.168.20220404 or greater, scopserv-network-22.214.171.124.20220406 or greater, scopserv-telephony25-126.96.36.199.20220404-2 or greater.
If MySQL Replication is not enabled then the standalone database is 'scopserv'
The scopserv database includes all server and network/firewall settings etc... so enabling MySQL Replication creates the 'scopserv_repl' database excluding those settings so that they are not overwritten during replication.
To revert to the standalone database you may disable MySQL Replication but you will lose all changes applied to the scopserv_repl database.
To backup 'scopserv_repl' and restore it to a standalone server:
mysqlcheck scopserv_repl -r (this will check and repair the database before backing it up)
mysqldump scopserv_repl > scopserv.sql (will backup scopserv_repl and save the file scopserv.sql to /root)
Copy the scopserv.sql file to a remote location and then upload a copy to the replacement server's /root directory
On the new server execute:
mysql scopserv < scopserv.sql
NOTE: you will have reconfigure your license and network settings if you convert HA to standalone.
We highly recommend that you update all packages to the latest versions. To proceed, go to Server -> Packages Manager and click on Update Now.
If you are planning to use DRDB and not RSYNC we strongly recommend reading the ‘DRBD User’s Guide’ available at http://www.drbd.org/users-guide-8.3/ that covers all aspect of Shared Storage (DRBD), including troubleshooting information.
Preparing your Network Configuration
The floating IP address is a dedicated IP address used by both the Master and Backup
It is recommended, though not strictly required, that you run your
RSYNC replication over a dedicated connection. The most
reasonable choice for this is a direct, back-to-back, Gigabit Ethernet
connection using IP addresses in the same subnet. If you cannot use IP addresses in the same subnet then you cannot implement a floating IP address and bind Asterisk to a single IP address.
The Floating IP address
Allows any SIP User Agents to bind to a single IP address for SIP traffic without having to configure a primary and backup SIP Registrar and/or SIP Proxy. This means that if the Master and Backup and Floating IP are not on the same subnet then any SIP phones must be configured with the Master and Backup server addresses. SIP carriers which use static IP's to handle incoming and outgoing PSTN traffic can only bind to a single IP address so in these cases the Floating IP address is mandatory.
If you are configuring a floating IP address then you must configure the Asterisk SIP channel to bind to the floating IP
In cases where the Floating IP address cannot be used then the option must be disabled
Here is an example of a Yealink Phone template configured to use the Floating IP address.
Here is an example of a Yealink Phone template configured to use a Primary and Backup IP address when the Floating IP address cannot be used.
– In these examples the Floating IP Address that will be used by VoIP devices is set to 192.168.192.50
– The Master Server will use IP Address 192.168.192.79
– The Backup Server will use IP Address 192.168.192.60
It is very important that both servers can reach each other using IP address or Hostname. On both servers, go to Network -> Configuration and verify that the specified hostname matches. On Network -> Static Hosts, you can create a hostname for each server or configure local DNS A records on a local DNS Server.
If each server is behind a firewall then the necessary open ports for MySQL Replication and Heartbeat are:
3306/tcp 2224/tcp 3121/tcp 5403/tcp 5404/udp 5405/udp
22/tcp is required for RSYNC
In the ScopTEL Firewall you can add these ports using Add a new Inbound Service
Heartbeat and RSYNC Configuration
The heartbeat service checks to see if the Master server is reachable and if it isn't shuts down asterisk and scopserv_realtime on the Master and starts those services on the Backup server and vice versa. It is critical that these services aren't running on both servers. Therefore on the Telephony Manager page these services will appear as locked.
To ensure that files are replicated for /var/spool/asterisk/voicemail /var/spool/asterisk/monitor /tftpboot /var/lib/asterisk/sounds/custom /varlib/asterisk/moh you must enable rsync Replication
And on the Master server you must execute from ssh this command:
ssh-keyinstall -s IP_<Address_of_Backup_Server>
Before configuring this section make sure that any Pop Up Blockers on your Web Browser are disabled for each server.
On both servers, go on Server -> MySQL Server -> Configuration and check the options Enable TCP/IP listenening and Enable High Availability Support and fill in the required fields.
Set the Mode to Main/Main Server (Circular) on both the Master and the Backup.
Set the Server Role for the Master to Main Server
Set the Server Role for the Backup Server to Backup Server.
Clive Save when done.
Once both Servers are fully configured reboot them.
Services Status and Verification
To check status navigate to Server|General and you will see current status as well as options to change Standby.
If there are errors after a reboot click on Resynchronize Database.