Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupOldWALFiles ¶
CleanupOldWALFiles removes WAL files older than the specified duration.
func RunBaseBackup ¶
func RunBaseBackup(ctx context.Context, cfg PITRConfig) (string, error)
RunBaseBackup executes pg_basebackup and stores the result.
func SetupPostgresWAL ¶
func SetupPostgresWAL(cfg PITRConfig) (configLines string, archiveDir string, err error)
SetupPostgresWAL generates the postgresql.conf changes needed for WAL archiving. Returns the config lines to add and the archive directory path.
Types ¶
type PITRConfig ¶
type PITRConfig struct {
DatabaseType string `json:"database_type"` // "postgresql" or "mysql"
ConnectionHost string `json:"connection_host"`
ConnectionPort int `json:"connection_port"`
DatabaseName string `json:"database_name"`
User string `json:"user"`
Password string `json:"password"`
WALArchiveDir string `json:"wal_archive_dir"`
BaseBackupDir string `json:"base_backup_dir"`
WALArchiveInterval int `json:"wal_archive_interval"` // seconds
BaseBackupCron string `json:"base_backup_cron"`
}
PITRConfig defines the configuration for point-in-time recovery.
type WALStatus ¶
type WALStatus struct {
LastWALArchived string `json:"last_wal_archived"`
WALArchiveCount int `json:"wal_archive_count"`
LastBaseBackup string `json:"last_base_backup"`
CurrentRPOSeconds int `json:"current_rpo_seconds"`
ArchiveDirSizeBytes int64 `json:"archive_dir_size_bytes"`
}
WALStatus reports the current state of WAL archiving.
func GetWALStatus ¶
func GetWALStatus(cfg PITRConfig) WALStatus
GetWALStatus returns the current state of WAL archiving.
Click to show internal directories.
Click to hide internal directories.