content_image/804488.jpg
$sth->finish; } ########## Set the replica to process from that location ######### sub UpdateReplica { $sth = $dbhS->prepare("CHANGE MASTER TO MASTER_LOG_FILE=’$binlog’, MASTER_LOG_POS=$binpos;") or die "Prepare to CHANGE MASTER error: ", $dbhS->errstr; $sth->execute or die "CHANGE MASTER on replica error: ", $sth->errstr; $sth->finish; print "	Replica has been updated. You may now start the replica.
"; } # end reset-replica.pl 

## 23.6.9.2 Point-In-Time Recovery Using NDB Cluster Replication 

Point-in-time  recovery—that is, recovery of data changes made since a given point in time—is performed after restoring a full backup that returns the server to its state when the backup was made. Performing point-in-time recovery of NDB Cluster tables with NDB Cluster and NDB Cluster Replication can be accomplished using a native NDB  data backup (taken by issuing CREATE BACKUP  in the ndb_mgm  client) and restoring the ndb_binlog_index  table (from a dump made using mysqldump ). 

To perform point-in-time recovery of NDB Cluster, it is necessary to follow the steps shown here: 

1. Back up all NDB  databases in the cluster, using the START BACKUP  command in the ndb_mgm  client (see Section 23.5.8, “Online Backup of NDB Cluster” ). 

2. At some later point, prior to restoring the cluster, make a backup of the mysql.ndb_binlog_index table. It is probably simplest to use mysqldump  for this task. Also back up the binary log files at this time. 

This backup should be updated regularly—perhaps even hourly—depending on your needs. 

3. ( Catastrophic failure or error occurs .) 

4. Locate the last known good backup. 

5. Clear the data node file systems (using ndbd --initial  or ndbmtd --initial ). 

<img src='content_image/804488.jpg'>

## Note 

Beginning with NDB 8.0.21, Disk Data tablespace and log files are removed by --initial . Previously, it was necessary to delete these manually. 

6. Use DROP TABLE  or TRUNCATE TABLE  with the mysql.ndb_binlog_index  table. 

7. Execute ndb_restore , restoring all data. You must include the --restore-epoch  option when you run ndb_restore , so that the ndb_apply_status  table is populated correctly. (See Section 23.4.23, “ndb_restore — Restore an NDB Cluster Backup” , for more information.) 

8. Restore the ndb_binlog_index  table from the output of mysqldump  and restore the binary log files from backup, if necessary. 

9. Find the epoch applied most recently—that is, the maximum epoch  column value in the ndb_apply_status  table—as the user variable @LATEST_EPOCH  (emphasized): 

