Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.
Aitor Pérez edited this page Feb 2, 2017 · 5 revisions

Welcome to the hdb-backup wiki! We are starting slowly but surely.

Installation

The recommended installation is through pip and a wheel file. In the release, there will be a .whl file. Simple run pip install <hdbbackup-wheel-file.whl> and let pip handle all the dependencies for you. You need internet connection for this.

Alternatively, you can download the source code with something like git clone https://github.com/Zerpet/hdb-backup and run python setup.py install, but this will not handle the dependencies for you. You will have to install the other dependencies (listed in README file) to make it work.

Usage

Backup mode

hawqbackup backup [-?] [--debug] [-q] [-v] [-U USERNAME] [-p PORT]
                  [-h HOST] [-w PASSWORD] -d DATABASE [-F]
                  [--include-roles] [-y] [--schema-only | --data-only]
                  [-s SCHEMA | -t TABLE | --exclude-table EXCLUDE_TABLE | --exclude-schema EXCLUDE_SCHEMA]

The option -d DATABASE is always required. The program will exit if this option is not provided.

Most of the options are self explanatory, here are described the non-intuitive ones.

  • -q quiet. Suppress output to stderr

  • -v print version information

  • --include-roles will dump user roles. There is a limitation in pg_dump to dump resource queue information; at the moment, it is not possible to dump RQ DDLs.

  • -y assume "yes" to every prompt. Useful when scripting the backup.

  • --schema-only will backup only the DDLs to create the database objects. No actual data is backed up. This option is not compatible with --data-only

  • --data-only will backup only table data. No DDLs are included in this backup. This option is not compatible with --schema-only

  • --exclude-table backup everything but the table/s specified here. This option expects the schema as part of the table name. If the schema or table name contain special characters, it must be double-quoted. This option accepts a comma-separated list

  • --exclude-schema backup everything but the tables under this schema. This option accepts a comma-separated list of schema names.

The following options are mutually exclusive:

-s SCHEMA
-t TABLE 
--exclude-table EXCLUDE_TABLE 
--exclude-schema EXCLUDE_SCHEMA

Restore mode:

hawqbackup restore [-?] [--debug] [-q] [-v] [-U USERNAME] [-p PORT]
                   [-h HOST] [-w PASSWORD] -d DATABASE [-F]
                   [--include-roles] [-y]
                   [--schema-only | --data-only] -k 201609220000
                   [--target-database TARGET_DATABASE]
                   [--ignore-error]
                   [--output-to-file | --input-file INPUT_FILE]

The option -d DATABASE is always required. The program will exit if this option is not provided.

  • -q quiet. Suppress output to stderr

  • -v print version information

  • --include-roles will restore user roles. By default it skips user roles; use this option to include them.

  • -y assume "yes" to every prompt. Useful when scripting the backup.

  • --schema-only will backup only the DDLs to create the database objects. No actual data is backed up. This option is not compatible with --data-only.

  • --data-only will backup only table data. No DDLs are included in this backup. This option is not compatible with --schema-only.

  • --target-database if you want to restore to a different database name. For example, backup taken for database foo, restore in database bar.

  • --ignore-error do not fail the restore upon error. This is handy when restoring --schema-only and some tables already exists in the database.

  • --output-to-file does not do any restore, but it prints a control file with a list of commands that would be done by the restore. This file is required when doing a selective restore (see below) as input of --input-file

  • --input-file control file with commands to execute during the restore. This file is generated by option --output-to-file.

Full backup vs selective backup

TODO: elaborate more selective backup is when you set any of the following: schema, table, exclude-schema, exclude-table

full backup is a backup of all the tables and schemas

selective restore is when you use a control file in input-file

full restore is a complete restore

Clone this wiki locally