@restoreverify/mysql
v0.2.4
Published
Verify every backup. Recover with confidence. Enterprise-grade database point-in-time recovery (PITR) and verification.
Readme
@restoreverify/mysql
Database adapter for MySQL in the RestoreVerify ecosystem.
RestoreVerify is an enterprise-grade, open source database point-in-time recovery (PITR) and verification tool.
This package provides the core adapter for MySQL to execute backups, restores, and verification drills programmatically via logical dumps and binlog replay.
Installation
npm install @restoreverify/mysql @restoreverify/core(Alternatively, you can install the unified restoreverify package which includes all adapters).
Functions
This adapter implements the standard RestoreVerify adapter interface:
backup(config): Initiates a logical backup usingmysqldump.restore(config): Restores the backup to a specific point-in-time by importing the dump and replaying binlogs viamysqlbinlog.verify(config): Connects to MySQL and runs queries to ensure data integrity.validateBackup(config): Validates the dump files and binlogs on disk.
Code Snippet Usage
import { mysqlAdapter } from '@restoreverify/mysql';
import { LocalBinaryStrategy, DockerExecStrategy } from '@restoreverify/core';
// Example: Backup a MySQL database inside Docker
async function performBackup() {
const result = await mysqlAdapter.backup({
connectionString: 'mysql://root:password@localhost:3306/mydb',
backupDir: '/mnt/backups/mysql',
walDir: '/mnt/binlogs/mysql',
// Run the backup command inside an existing Docker container!
strategy: new DockerExecStrategy('my-mysql-container')
});
if (result.success) {
console.log(`Backup completed successfully! ID: ${result.backupId}`);
} else {
console.error(`Backup failed: ${result.error}`);
}
}
performBackup();Author
Avisekh Kumar Tewari
GitHub: https://github.com/Avisekh02
