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.

    Note

    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 dsctl -event mysql-bin.000032:0000000473863524
      dsctl -service alpha set -reset -seqno 7748 -epoch 0 -event-id "mysql-bin.000032:0000000473863524" -source-id "db1-east.continuent.com"
      
      ~OR~
      
      shell> thl list -event mysql-bin.000032:0000000473863524 -headers
      SEQ# = 7748 / FRAG# = 0 (last frag)
      - FILE = thl.data.0000000010
      - TIME = 2014-10-17 16:58:11.0
      - EPOCH# = 0
      - EVENTID = mysql-bin.000032:0000000473863524;-1
      - SOURCEID = db1-east.continuent.com
      
      shell> exit

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

      shell> dsctl -service alpha set -reset \
           -seqno 7748 \
           -epoch 0 \
           -source-id db1-east.continuent.com \
           -event-id mysql-bin.000032:0000000473863524
      

  5. Put the replication service online using trepctl:

    shell> trepctl online