NDB Cluster Backups With NDB Cluster Replication use DBI; ######################## Globals ################################ my $m_host=’’; my $m_port=’’; my $m_user=’’; my $m_pass=’’; my $s_host=’’; my $s_port=’’; my $s_user=’’; my $s_pass=’’; my $dbhM=’’; my $dbhS=’’; ####################### Sub Prototypes ########################## sub CollectCommandPromptInfo; sub ConnectToDatabases; sub DisconnectFromDatabases; sub GetReplicaEpoch; sub GetSourceInfo; sub UpdateReplica; ######################## Program Main ########################### CollectCommandPromptInfo; ConnectToDatabases; GetReplicaEpoch; GetSourceInfo; UpdateReplica; DisconnectFromDatabases; ################## Collect Command Prompt Info ################## sub CollectCommandPromptInfo { ### Check that user has supplied correct number of command line args die "Usage:
 reset-replica >source MySQL host< >source MySQL port< 
 >source user< >source pass< >replica MySQL host< 
 >replica MySQL port< >replica user< >replica pass< 
 All 8 arguments must be passed. Use BLANK for NULL passwords
" unless @ARGV == 8; $m_host = $ARGV[0]; $m_port = $ARGV[1]; $m_user = $ARGV[2]; $m_pass = $ARGV[3]; $s_host = $ARGV[4]; $s_port = $ARGV[5]; $s_user = $ARGV[6]; $s_pass = $ARGV[7]; if ($m_pass eq "BLANK") { $m_pass = ’’;} if ($s_pass eq "BLANK") { $s_pass = ’’;} } ############### Make connections to both databases ############# sub ConnectToDatabases { ### Connect to both source and replica cluster databases ### Connect to source $dbhM 4634