Configure MySQL Database master-slave replication is for data to be more secure, better performance, can achieve fast failover and so on
Here are two dual-core 4GB memory of the Ubuntu 14.04+mariadb-10.0.13 master and slave copy. Let's take a look at the my.cnf configuration file where we compiled the installed MARIADB database:
The result of the above means that the MySQL server will first find my.cnf in the directory/etc, followed by the/etc/mysql/directory to find, and so on ... Since I compiled the MY.CNF configuration file was specified under the:/app/mysql/etc directory. All we first link the configuration file to the directory/etc below:
Ln-s/app/mysql/etc/my.cnf/etc/my.cnf
The configuration of the primary mariadb is as follows:
Note The default Log-bin binary log and configure a new binary log file path to create a new binary log storage directory:
Mkdir/app/mysql/logs && chown mysql.mysql-r/app/mysql/logs
New MARIADB database user with replication permissions:
GRANT REPLICATION SLAVE on *.* to ' backup ' @ ' 42.159.228.231 ' identified by ' Mariadbbak. '
To this end, the main mariadb configuration is completed, restart the MySQL server. For more details, see the status of master database server.
From the MARIADB server configuration:
Note that Server-id must be not 1, must be greater than 1 of the other number, here is set 12.read-only = on means: Open the relay log, relay_log refers to the log path;
The above configuration file is the default except for the annotation of #log-bin=mysql-bin. So, the configuration is very simple. Below to verify the next.
Start MARIADB from server:
Start slave;
show slave status;
Create a database on the primary server to verify that it is synchronized to the server:
To this end, the MARIADB master-slave replication on the Azure cloud is configured. Haven't posted many pictures in a long time.