Kinton Database replication

Install MariaDB on replica server

Install the same MariaDB server package that Abiquo API server is using on the replica server.

  1. On the replica server, Install your abiquo-release package

  2. Install MariaDB with this command

    yum -y install MariaDB-server MariaDB-client

 


Configure DB replication on the main DB server

  1. On the main DB server, create the replication configuration file

    cat <<EOF >/etc/my.cnf.d/replication.cnf [server] log-basename=master log-bin binlog-format=row server_id=1 EOF

     

  2. Restart the mysql service

    service mysql restart

     

  3. Create a replicator user and grant it replication permissions by executing the query below on DB prompt. Replace REPLICA_USER, REPLICA_PASS, and REPLICA_SERVER with values for your environment.

 


Configure DB replication on replica DB server

  1. Create the replication configuration file in Maria DB replica server.

  2. Restart the mysql service.

To use multiple replica servers, in /etc/my.cnf.d/replication.cnf for each replica server, you must define a different server_id, and it must be greater than the server_id of the main server.


Perform initial replication

To perform the initial replication, get the current status of the main DB, including the file and the current position in the log, and then perform a dump of the database with the following steps

  1. Open a new session on the main DB server at the mysql prompt

  2. Run the following commands to get the file and current position

  3. Leave this session open and don’t make any changes until replication is completed.

  4. On the MariaDB main server, open another session and dump the kinton and kinton_accounting databases using --single-transaction option

 

 


Configure slave replication point

  1. Copy dump.sql from the previous step from the main DB server to the replica DB server.

  2. When the copy finishes, import it into replica DB server. If this is a new installation you may need to create the kinton databases.

  3. When the import finishes, configure replica DB server replication. On the replica DB server, go to the mysql prompt and run the change master command below

    1. Replace MAIN_SERVER, REPLICA_USER and REPLICA_PASS.

    2. Replace MASTER_LOG_FILE and MASTER_LOG_POS from the show master status above

      For example, using the values from above of  master-bin.000001 and  3712878

  4. On the replica server, at the mysql prompt, start replica DB replication

     

  5. To check replication status, run the following command on the replica DB

    When Slave_IO_State is Waiting for master to send event, replication is finished

  6. Release locks by closing the first session on master DB server where locks were set and the master status was requested, and you are done!



References

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



Unable to render {include} The included page could not be found.