V3 Appliance Database Sync

From Swivel Knowledgebase
Jump to: navigation, search



Introduction

Prior to performing a database sync you will need to follow the “Setting Up a High Availability (HA) Pair” section to ensure that your HA Pair is setup correctly.

If your HA Pair is already setup then you can follow this guide to perform a manual sync of the Database.


Database Replication Basics

When a database is set to replicate the changes that are made on one server (Master) are copied across to the other (Slave) server.

The process for doing this is that when the Master writes a change to the database it logs the change made to a BIN Log.

The Slave copies across that BIN log and makes a local copy of that log file called a Relay Log.

The Slave then processes the transactions in that Relay Log thus making the same changes to the local slave database that were made on the Remote Master database.

A Master server can have many Slaves but a Slave can only have one Master.

Master-Master Replication

A server can be both a Master and a Slave so if they are, as in a Swivel HA Pair, as peers, one is both a Master and Slave to the other so replication works both ways between the two servers.

For replication to work The Master must be set up as a Master so that it creates the BIN Logs Slave must have permission on the Master to read BIN logs Slave IO must be running, this reads the BIN logs across to create RELAY logs Slave MySQL must be running to process RELAY logs.


Perform a Manual Sync

To access the High Availability Menu, login to the Appliance using PuTTY.

Select the menu option High Availability -> Database Replication.

From this menu you are able to check the replication status and repair replication.


Check the Status

From the .. Database Replication -> Status screen, select the IP of the appliance that you want to check the status of. Any replication errors that need to be addressed prior to a successful repair will be listed here.


Repair Replication

From the .. Database Replication -> Repair Replication screen, select the Peer IP of the appliance that you want to repair replication for.

You will then be prompted to confirm which way you want to syncronise the data.

For example if you select the Local database as the canonical (correct) database, then the Local database will be synced with the Peer you selected.

However if you select the Peer database as the canonical database, the Peer database will be synced to the Local machine that you’re logged into.

After selecting which database you want to sync, you will be asked to confirm.

If the sync worked as expected you will receive an “INFO: Sent database to peer” message.