Applies to VoipNow 3.X and higher!
Every time an API request is sent or a call report is generated, the SQL server receives a query. As a result, the load on the server is affected by the number of requests and the volume of data that should be returned by the SQL server.
By default, VoipNow is able to send all the read requests to a slave node and all the inserts to the master node. Basically, every time a user wants to generate a call report for an entire month, his request will be directed to the slave server. This pattern could cause problems if the replication of the data does not happen in real time and the slave remains behind the master. The MWI and presence notifications in particular are most affected.
To avoid this kind of issues, the latency between those two nodes must be as small as possible. This article will help you set up a replication between two SQL servers.
Before taking each step, make sure that you have both SQL nodes installed as recommended in our documentation for distributed environments. Another mandatory condition is that both nodes are Online. Your interface settings should look as shown in the image below.
Edit MySQL config file on the master server: /etc/my.cnf. At the end of the file, add the following lines. Then save changes and restart MySQL.
Add the MySQL user destined for replication with the appropriate rights. Log in on MySQL CLI and run the following command:
passwordstring with a custom, complex password. You can generate one using http://passwordsgenerator.net/ or a similar site.
Stop the MySQL service on the slave server:
Go back to the master node and run the following command. In order to synchronize the folders, you will have to provide the root password for connecting via SSH on the slave server.
<slave_ip>with your SQL slave IP address.
Lock the database to prevent any new changes.
Check status on master server:
Again, synchronize the MySQL home directory on the slave server. Run the rsync command on the master server one more time.
Edit MySQL config file on the slave server: /etc/my.cnf. At the end of the file, add the following lines:
Start MySQL service on the slave server, connect to MySQL CLI and run the following command:
Set the master parameters on the slave server.
Enter correct configuration parameters
<master_ip>with your SQL master IP address.
<password>with the previously generated password.
<log_file>with the log file name displayed in step 6 (
centos-6-b64-test-bin.000001in our example).
<position>with the position index displayed in step 6 (
43311833in our example).
Then disable the partition update event and start the slave node:
Check the slave status.
A successful replication is indicated by
Yes. If the two parameters have different values, replication is not configured correctly.
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.