![]() ![]() It means that MariaDB replication works in one direction only. The data are not replicated from slave to master. Let’s check if it has appeared on the Master. Make sure that the database has been created on the Slave server as well:Ĭreate a database on the Slave server and check if the database has been replicated to the Master.Īs you can see, we have created the database and it exists on the Slave. To check the Slave status: SHOW SLAVE STATUS\G You must also create the database memory dump and use it for initial upload of data to MariaDB on your slave server. When you configure replication for the existing MariaDB database, you must put the database to the read-only mode prior starting the replication in order bin_log number not to be updated. MariaDB > CHANGE MASTER TO MASTER_HOST='IP_master', MASTER_USER='test_master', MASTER_PASSWORD='test_master', MASTER_LOG_FILE='mariadb-bin.000001', MASTER_LOG_POS=664 Run these commands in the mariadb console on slave server: | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Get the bin_log info from the first server: Add the following configuration to the slave my.cnf file: #replication When configuring the master+slave replication of MariaDB database, the master server (master1) is configured as described above. Thus, you make the database response as fast as possible. You can also distribute the database load for your project so that the apps will read data from your Slave servers and write the data only to the Master server. In this configuration, you always have a backup server with up-to-date database, and if a slave server fails, the Master will not lost any data. This database replication type is more resilient and used more often. All changes you make on the Slave server won’t be transferred to the Master server. In the master-slave MariaDB replication mode, one server acts as a slave, and data from the Master server are constantly written to it. How to Set Up Master-Slave Replication in MariaDB? The hello_master1 table has been replicated to the first server:Īs you can see, the new table has appeared on Master-1. To check the full cycle, create a table in the Master1 database on the second Master server and check if it appears on the first server. The database has been created on the second master as well. Make sure that this database has automatically replicated on the second master and contains the same table: Then to make sure that the replication between two MariaDB servers works in master+master, we will create a new database on Master-1 and create a table in it. How to Check Replication Between MariaDB Servers? Relay_log_index = /var/lib/mysql/relay-bin.indexĪs you can see in the screenshots, there is the connection between two servers, and no errors occur. Log_bin_index = /var/lib/mysql/mariadb-bin.index MariaDB: Configuration of the First Master Server (Master-1)Īdd the following lines to my.cnf file on your first MariaDB server: #replication A Slave server connects to the Master and applies the commands to its databases. Replication is based on a special binlog file, a Master server saves all operations with the database to. In a Master-Master replication scheme, any of the MariaDB/MySQL database servers may be used both to write or read data. Configuring Simple Master-Master Replication on MariaDB So we won’t focus on the MariaDB installation itself, but move on to how to configure the replication. How to Set Up Master-Slave Replication in MariaDB?Įarlier we published an article describing the process of MariaDB installation on CentOS 7.Configuring Simple Master-Master Replication on MariaDB.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |