Allow MariaDB port
sudo ufw allow 3306
Edit Config File
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
#bind-address (Comment out)
server-id = X
report_host = masterX
log_bin = /var/log/mysql/mysql-bin.log
relay_log = /var/lib/mysql/relay-bin
relay_log_index = /var/lib/mysql/relay-bin.index
log-slave-updates
auto_increment_increment=2
auto_increment_offset=X
Where X is the master number
Create User on Database 1
CREATE USER 'repl'@'%' IDENTIFIED BY 'repl_passwd';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
Create User on Database 2
CREATE USER 'repl2'@'%' IDENTIFIED BY 'repl_passwd2';
GRANT REPLICATION SLAVE ON *.* TO 'repl2'@'%';
Create Slave on Database 1
CHANGE MASTER TO MASTER_HOST='10.0.2.4', MASTER_USER='repl_master2', MASTER_PASSWORD='repl_passwd2';
START SLAVE;
Create Slave on Database 2
CHANGE MASTER TO MASTER_HOST='10.0.2.15', MASTER_USER='repl', MASTER_PASSWORD='repl_passwd';
START SLAVE;