PostgreSQL database

GoBackup use pg_dump utility to backup PostgreSQL database into a .sql file.

If your host not have pg_dump you need install it first.

NOTE: PostgreSQL requirement pg_dump have a same version with server, so if your PostgreSQL server,you can follow this guides to install same version of postgresql-contrib:

Follow the guides to Install the repository RPM, and then run:

  1. # For Ubuntu
  2. $ sudo apt-get install postgresql10-contrib
  3. # For Red Hat
  4. $ sudo yum install postgresql10-contrib
  5. # For AlpineLinux
  6. $ apk add postgresql-client

Database config keys

type: postgresql

  • host - server host, default: localhost
  • port - server port, default: 5432
  • database - database name
  • username - default: root
  • password

https://github.com/huacnlee/gobackup/blob/master/database/postgresql.go

Restore Database

  1. $ psql -U postgres -d your-database -f /path/to/your-backup.sql