6.11.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. Shun the datasource to be restored, and put the replicator service offline using cctrl :

    [LOGICAL:EXPERT] /alpha > datasource host2 shun
    [LOGICAL:EXPERT] /alpha > replicator host2 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 6.10.4, “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. Recover the datasource using cctrl :

    [LOGICAL] /alpha > datasource host2 recover

    The recover command will start the dataserver if it was left running and then bring the replicator and other operations online.