Setting up a slave DB server
Earlier in this chapter, we discussed installing MariaDB on a server. To set up a slave, all you really need to begin the process is set up another database server. If you've already set up two database servers, you're ready to begin. If not, feel free to spin up another VM and follow the process from earlier in this chapter that covered installing MariaDB. Go ahead and set up another server if you haven't already done so. Of your two servers, one should be designated as the master and the other the slave, so make a note of the IP addresses for each.
To begin, we'll first start working on the master. We'll need to edit the /etc/mysql/conf.d/mysql.cnf
file. Currently, the file contains just the following line:
[mysql]
Right underneath that, add a blank line and then the following code:
[mysqld] log-bin binlog-do-db=mysampledb server-id=1
With this configuration, we're first enabling bin-logging, which is required for a master/slave server to function properly. These...