Package DE_EPAGES::Database::API::BackupMySQL
Functions in this modules are used with backup/restore MySQL databases
@EXPORT_OK |
Functions
- BackupBinLogs
- CheckLogFullArguments
- CheckMySQLSettings
- DeleteOldLogs
- GetBinLogFiles
- GetInnoBackupExe
- GetMySQLConf
- GetMySQLSettings
- GetStoreConf
- IgnoreDumpsNewerThan
- MyCnfDefault
- MySQLShowVariables
- RestoreBinLogs
BackupBinLogs
Copies binary log files to backup location; this location is created in $hSettings->{DumpDir}/binlog/$hSettings->{BinLogSubDir}
Syntax |
BackupBinLogs($hSettings, $Verbose); |
Example |
BackupBinLogs(GetMySQLSettings($Store), $Verbose); |
Input |
|
CheckLogFullArguments
Checks, if all necessary parameters are set for log/full backup.
Syntax |
my $ErrorMsg = CheckLogFullArguments($Full,$Log,$DelLog,$MvOld); |
Input |
|
Return |
|
CheckMySQLSettings
Checks if $hSettings contains required keys plus @Defined and @Exists.
Syntax |
my $ErrorMsg = CheckMySQLSettings($hSettings, [@Defined], [@Exists]); |
Example |
my $ErrorMsg = CheckMySQLSettings(GetMySQLSettings($Store)); |
Input |
|
Return |
|
DeleteOldLogs
Deletes binary logfiles which are older than $Days days.
Syntax |
DeleteOldLogs($DumpDir, $BinLogSubDir, $Days, $Verbose); |
Example |
DeleteOldLogs('/tmp', undef, 14, 1); |
Input |
|
GetBinLogFiles
Returns all binlog files contained in the binlog index file
Copies binary log files to backup location; this location is created in $hSettings->{DumpDir}/binlog/$hSettings->{BinLogSubDir}
Syntax |
my $aBinLogFiles = GetBinLogFiles($hSettings); |
Example |
my $aBinLogFiles = GetBinLogFiles(GetMySQLSettings($Store)); |
Input |
|
Return |
|
GetInnoBackupExe
Returns 1 if $InnoBackupExe is executable, 0 otherwise. If $InnoBackupExe is empty, the executable is searched in /opt/mysql/meb-3.5/bin/ibbackup and PATH and $InnoBackupExe is set. If found, returns 1, otherwise 0.
Syntax |
my $Result = GetInnoBackupExe(\$InnoBackupExe); |
Input |
|
Return |
|
GetMySQLConf
Returns hash of MySQL settings from $MySQLConfigFile. In $hSettings returned parameters can just exist (no-value parameters) or be defined by a value. Thatswhy, check both exists($hSettings->{}) and/or defined($hSettings->{}). All hyphens (-) in keys in $hSettings are translated to underscores(_). You won't find $hSettings->{'log-bin'}, but $hSettings->{log_bin}.
Syntax |
$hSettings = GetMySQLConf($MySQLConfigFile); |
Input |
|
Return |
|
GetMySQLSettings
Returns hash of combined output of MySQLShowVariables(), GetStoreConf() and GetMySQLConf(), see above.
Syntax |
$hSettings = GetMySQLSettings($Store, $BackupStore); |
Input |
|
Return |
|
GetStoreConf
Returns hash of ConnectionData retrieved from DatabaseConnectionData($Store) and DatabaseBackupData($Store,$BackupStore).
Syntax |
$hSettings = GetStoreConf($Store, $BackupStore); |
Input |
|
Return |
|
IgnoreDumpsNewerThan
Renames files newer than $DumpDate in $hSettings->{DumpDir}
Syntax |
IgnoreDumpsNewerThan($DumpDate, $hSettings, $LVM); |
Example |
IgnoreDumpsNewerThan($DumpDate, GetStoreConf($Store)); |
Input |
|
MyCnfDefault
Returns the best guess for MySQL config file name (file might not exist) depending on $Basedir (from MySQLShowVariables()->{basedir}, see below)
Syntax |
my $ConfigFileName = MyCnfDefault($BaseDir); |
Input |
|
Return |
|
MySQLShowVariables
Returns hash of MySQL settings for $StoreName from 'SHOW VARIABLES'. In $Settings returned parameters can just exist (no-value parameters) or be defined by a value. Thatswhy check both exists($hSettings->{}) and/or defined($hSettings->{}).
Syntax |
$hSettings = MySQLShowVariables($StoreName); |
Input |
|
Return |
|
RestoreBinLogs
Restores backed up log files at start position from the directory $hSettings->{DumpDir}/binlog/. Does nothing if dump directory does not exist.
Syntax |
RestoreBinLogs($StartLogFile, $StartPosition, $EndLogFile, $EndPosition, $hSettings, $Verbose); |
Input |
|