Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

t

Table of Contents

Install MariaDB on slave server

...

Warning

Remember that, if you are using multiple slaves, each one must has a different server_id defined in /etc/my.cnf.d/replication.cnf, and it must be greater than the server_id of the master.

 


Initial replication

Open a new session on master DB server and execute the commands below in at the mysql prompt. This will show master current status including the file and the current position in the log. We will need this later when replicating the DB in the slave. Leave this session as it is until replication is completed:

...

Once imported, configure slave DB server replication. Replace In the command below, replace MASTER_SERVER, REPLICA_USER , and REPLICA_PASS, .
Also replace  MASTER_LOG_FILE and MASTER_LOG_POS accordingly to previous steps in command below and execute it in slave server from the show master status (e.g. from above  "master-bin.000001" and  "3712878") . 
Run this command on the slave server at the mysql prompt:

Code Block
change master to
  MASTER_HOST='MASTER_SERVER',
  MASTER_USER='REPLICA_USER',
  MASTER_PASSWORD='REPLICA_PASS',
  MASTER_PORT=3306,
  MASTER_LOG_FILE='master-bin.000001MASTER_LOG_FILE',
  MASTER_LOG_POS=3712878'MASTER_LOG_POS',
  MASTER_CONNECT_RETRY=10;

...

Code Block
show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
...
1 row in set (0.00 sec)

Once When Slave_IO_State is "Waiting for master to send event" replication is finished.

Check the master status again. Then, close

Code Block
mysql --execute 'SHOW MASTER STATUS;'

Then release locks by closing the first session on master DB server where locks were set and the master status was requested to release locks and you are done.!


References

https://mariadb.com/kb/en/setting-up-replication/