ePages 6.10 - DE_EPAGES/Database/API/BackupMySQL.pm

Package DE_EPAGES::Database::API::BackupMySQL

@EXPORT_OK
BackupBinLogs
GetBinLogFiles
DeleteOldLogs
RestoreBinLogs
GetBackupCredentials

Functions

BackupBinLogs
DeleteOldLogs
GetBackupCredentials
GetBinLogFiles
RestoreBinLogs

BackupBinLogs

Copies binary log files to backup location; this location is created in $DumpDir/binlog/

Syntax
BackupBinLogs($MySQLConfigFile, $LogDirName, $NoOutput, $User, $Password);
Example
BackupBinLogs("/etc/my.cnf", "/tmp");
Input
$MySQLConfigFile (string)
location of my.cnf/my.ini
$DumpDir (string)
destination where dumps are copied to
$Verbose (string)
print messages to stdout
$User (string)
Database user or login name (optional)
$Password (string)
Database user password (optional)

DeleteOldLogs

Deletes binary logfiles which are older than $Days days.

Syntax
DeleteOldLogs($LogDirName, $Days, $Verbose);
Example
DeleteOldLogs("/tmp", 14, 1);
Input
$LogDirName (string)
destination where logfiles were backed up to
$Days (integer)
number of days to keep old binlog files
$Verbose (string
========================================================================================)
print messages to stdout

GetBackupCredentials

Returns the user and password for the epages backup user from Database.conf. Limitation: Does currently not work with encrypted passwords.

Syntax
($User, $Password) = GetBackupCredentials($Storename);
Example
($User, $Password) = GetBackupCredentials('Store');
Input
$Storename (string)
name of the store to get the credentials from
Return
$User (string)
login name
$Password (string)
password

GetBinLogFiles

Returns all binlog files contained in the binlog index file

Syntax
my $aBinLogFiles = GetBinLogFiles($MySQLConfigFile);
Example
my $aBinLogFiles = GetBinLogFiles("/etc/my.cnf");
Input
$MySQLConfigFile (string)
location of my.cnf/my.ini
Return
$aBinLogFiles (ref.array
========================================================================================)
array whith absolute filenames

RestoreBinLogs

Restores backed up log files at start position from the directory $DumpDir/binlog/. Does nothing if the directory $DumpDir/binlog/ does not exist.

Syntax
RestoreBinLogs($StartLogFileNumber, $StartPosition,
$DumpDir, $DBName, $User, $Password, $NoOutput);
Input
$StartLogFile (string)
name of first log file to apply
$StartPosition (integer)
number of first log position to apply
$EndPosition (integer)
number of last log position to apply
$DumpDir (string)
directory where files were backed up to
$DBName (string)
database name to restore (empty for all databases)
$User (string)
Database user or login name (optional)
$Password (string)
Database user password (optional)
$Verbose (string
========================================================================================)
print messages to stdout