MariaDB supports built-in replication; it can be used for several purposes. The most common reason to build a replication environment is to increase data redundancy for improving the fault tolerance. Also, while replication does not replace a good backup plan, a slave data can sometimes be used as a backup for the master in case of data loss. Another use of replication is writing data into the master and spreading the queries through two or more slaves, to improve performance.
In the previous chapter, we discussed backups. Knowing this topic is very important now, because replication, just as with some backup types, is based on the binary log.
In this chapter we will learn:
How replication works in MariaDB
Setting up a master and a slave
Loading data into a slave or a new master
Configuring masters and slaves
Rotating replication logs
Checking the slaves' data integrity
Solving the most common replication problems