Reference: http://woshub.com/configure-mariadb-replication
Summary
Export DB
mysqldump -u root -p –all-databases >> mysqldump.sql
Copy to other slave
scp -i ~/.ssh/yourkey.pvt mysqldump.sql webapp@hostname:~/mysqldump.sql
Create user on master for replication
CREATE USER ‘replication_user’@’%’ IDENTIFIED BY ‘some_password_yo’;
GRANT REPLICATION SLAVE ON *.* TO ‘replication_user’@’%’;
Slave setup
stop slave
CHANGE MASTER TO MASTER_HOST=’master_hostname’, MASTER_USER=’replication_user’, MASTER_PASSWORD=’some_password_yo, MASTER_LOG_FILE=’mariadb-bin.000001′, MASTER_LOG_POS=1064;
start slave
show slave status \G
show master status \G
Binary log rotation
expire_logs_days=10