7.8.2. Restoring an External Backup

If a backup has been performed outside of Tungsten Cluster, for example from filesystem snapshot or a backup performed outside of the dataservice, follow these steps:

  1. Put the replication service offline using trepctl:

    shell> trepctl offline
  2. Reset the THL, either using thl or by deleting the files directly :

    shell> thl -service alpha purge
  3. Restore the data or files using the external tool. This may require the database server to be stopped. If so, you should restart the database server before moving to the next step.


    The backup must be complete and the tungsten specific schemas must be part of the recovered data, as they are required to restart replication at the correct point. See Section 7.7.3, “Creating an External Backup” for more information on creating backups.

  4. There is some additional work if the backup was taken of the Primary server. There may be a difference between the binary log position of the Primary and what is represented in the trep_commit_seqno. If these values are the same, you may proceed without further work. If not, the content of trep_commit_seqno must be updated.

    • Retrieve the contents of trep_commit_seqno :

      shell> echo "select seqno,source_id, eventid from tungsten_alpha.trep_commit_seqno" | tpm mysql
      seqno	source_id	eventid
      32033674	host1	mysql-bin.000032:0000000473860407;-1

    • Compare the results to the binary log position of the restored backup. For this example we will assume the backup was taken at mysql-bin.000032:473863524. Return to the Primary and find the correct sequence number for that position :

      shell> ssh host1
      shell> thl list -service alpha -low 32033674 -headers | grep 473863524
      32033678	32030709	0	true	2014-10-17 16:58:11.0	mysql-bin.000032:0000000473863524;-1	db1-east.continuent.com
      shell> exit

    • Return to the Replica node and run tungsten_set_position to update the trep_commit_seqno table :

      shell> tungsten_set_position --service=alpha --source=host1 --seqno=32033678

  5. Put the replication service online using trepctl:

    shell> trepctl online