@restoreverify/postgres
v0.2.4
Published
Verify every backup. Recover with confidence. Enterprise-grade database point-in-time recovery (PITR) and verification.
Maintainers
Readme
@restoreverify/postgres
Database adapter for PostgreSQL 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 PostgreSQL to execute backups, restores, and verification drills programmatically via pg_basebackup and WAL archives.
Installation
npm install @restoreverify/postgres @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 physical backup usingpg_basebackup.restore(config): Restores the backup to a specific point-in-time viarecovery.conf/postgresql.auto.confand WAL replay.verify(config): Connects to Postgres and runs queries to ensure data integrity.validateBackup(config): Validates the base backup files and WAL archives on disk.
Code Snippet Usage
import { postgresAdapter } from '@restoreverify/postgres';
import { LocalBinaryStrategy, DockerExecStrategy } from '@restoreverify/core';
// Example: Backup a PostgreSQL database locally
async function performBackup() {
const result = await postgresAdapter.backup({
connectionString: 'postgresql://postgres:password@localhost:5432/postgres',
backupDir: '/mnt/backups/pg',
walDir: '/mnt/wal/pg',
// Choose your execution strategy (Local, Docker, Kubernetes, SSH)
strategy: new LocalBinaryStrategy()
});
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
