GreenPlum 大數據平台--並行備份(四)


01,並行備份(gp_dump)

  1) GP同時備份Master和所有活動的Segment實例
  2) 備份消耗的時間與系統中實例的數量沒有關系
  3) 在Master主機上備份所有DDL文件和GP相關的數據字典表
  4) 每個Segment備份各自的數據
  5) 所有備份文件組成一個完整的備份集合,通過唯一14位數字的時間戳來識別

gp_dump dumps a database as a text file or to other formats.

Usage:
  gp_dump [OPTION]... [DBNAME]

General options:
  -i, --ignore-version     proceed even when server version mismatches
                           gp_dump version
  -v, --verbose            verbose mode. adds verbose information to the
                           per segment status files
  --help                   show this help, then exit
  --version                output version information, then exit

Options controlling the output content:
  -a, --data-only          dump only the data, not the schema
  -c, --clean              clean (drop) schema prior to create
  -d, --inserts            dump data as INSERT, rather than COPY, commands
  -D, --column-inserts     dump data as INSERT commands with column names
  -E, --encoding=ENCODING  dump the data in encoding ENCODING
  -n, --schema=SCHEMA      dump the named schema only
  -N, --exclude-schema=SCHEMA do NOT dump the named schema(s)
  -o, --oids               include OIDs in dump
  -O, --no-owner           do not output commands to set object ownership
                           in plain text format
  -s, --schema-only        dump only the schema, no data
  -S, --superuser=NAME     specify the superuser user name to use in
                           plain text format
  -t, --table=TABLE        dump only matching table(s) (or views or sequences)
  -T, --exclude-table=TABLE   do NOT dump matching table(s) (or views or sequences)
  -x, --no-privileges      do not dump privileges (grant/revoke)
  --disable-triggers       disable triggers during data-only restore
  --incremental            dump only modified patitions
  --use-set-session-authorization
                              use SESSION AUTHORIZATION commands instead of
                              ALTER OWNER commands to set ownership

Connection options:
  -h, --host=HOSTNAME      database server host or socket directory
  -p, --port=PORT          database server port number
  -U, --username=NAME      connect as specified database user
  -W, --password           force password prompt (should happen automatically)

Greenplum Database specific options:
  --gp-c                  use gzip for in-line compression
  --gp-d=BACKUPFILEDIR    directory where backup files are placed
  --gp-k=TIMESTAMP        timestamp key to be used for the dump files
  --gp-r=REPORTFILEDIR    directory where report file is placed
  --gp-s=BACKUPSET        backup set indicator - (p)rimaries only (default)
                          or (i)ndividual segdb (must be followed with a list of dbids
                          of primary segments to dump. For example: --gp-s=i[10,12,14]
  --rsyncable             pass --rsyncable option to gzip  --ddboost-storage-unit             pass the storage unit name
If no database name is supplied, then the PGDATABASE environment
variable value is used.

我們來看下具體備份:

創建備份目錄(所有節點):
mkdir -p /gpbackup
chown -R gpadmin. /gpbackup/

如果報錯了:
20190319:02:54:01|gp_dump-[FATAL]:-could not start Greenplum Database backup: ERROR:  could not create backup directory "/gpbackup/": Permission denied

那應該就是沒創建好,或者沒有授權,所有幾點重新操作

備份開始:


[gpadmin@greenplum01 gpseg-1]$ gp_dump -h 192.168.0.221 -p 5432 -U gpadmin -d postgres  --gp-d /gpbackup/ --gp-r /gpbackup/
 --inserts is preferred over -d.  -d is deprecated.
20190319:03:00:20|gp_dump-[INFO]:-Read params: -d
20190319:03:00:20|gp_dump-[INFO]:-Command line options analyzed.
20190319:03:00:20|gp_dump-[INFO]:-Connecting to master database on host 192.168.0.221 port 5432 database postgres.
20190319:03:00:20|gp_dump-[INFO]:-Reading Greenplum Database configuration info from master database.
20190319:03:00:20|gp_dump-[INFO]:-Preparing to dump the following segments:
20190319:03:00:20|gp_dump-[INFO]:-Segment 7 (dbid 9)
20190319:03:00:20|gp_dump-[INFO]:-Segment 6 (dbid 8)
20190319:03:00:20|gp_dump-[INFO]:-Segment 5 (dbid 7)
20190319:03:00:20|gp_dump-[INFO]:-Segment 4 (dbid 6)
20190319:03:00:20|gp_dump-[INFO]:-Segment 3 (dbid 5)
20190319:03:00:20|gp_dump-[INFO]:-Segment 2 (dbid 4)
20190319:03:00:20|gp_dump-[INFO]:-Segment 1 (dbid 3)
20190319:03:00:20|gp_dump-[INFO]:-Segment 0 (dbid 2)
20190319:03:00:20|gp_dump-[INFO]:-Master (dbid 1)
20190319:03:00:20|gp_dump-[INFO]:-Starting a transaction on master database postgres.
20190319:03:00:20|gp_dump-[INFO]:-Getting a lock on pg_class in database postgres.
20190319:03:00:20|GetTimestampKey-[INFO]:-Timestamp key is generated as it is not provided by the user.
20190319:03:00:20|gp_dump-[INFO]:-About to spin off 9 threads with timestamp key 20190319030020
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 9: host greenplum03 port 6003 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 8: host greenplum03 port 6002 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 7: host greenplum03 port 6001 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 6: host greenplum03 port 6000 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 5: host greenplum02 port 6003 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 4: host greenplum02 port 6002 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 3: host greenplum02 port 6001 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 2: host greenplum02 port 6000 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Creating thread to backup dbid 1: host greenplum01 port 5432 database postgres
20190319:03:00:20|gp_dump-[INFO]:-Waiting for remote gp_dump_agent processes to start transactions in serializable isolation level
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 1 connection
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 7 connection
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 5 connection
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 3 connection
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 7 server
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 5 server
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 3 server
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 9 connection
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 9 server
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 8 connection
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 8 server
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 4 connection
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 2 connection
20190319:03:00:20|gp_dump-[INFO]:-Listening for messages from server on dbid 6 connection
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 4 server
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 6 server
20190319:03:00:20|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 2 server
20190319:03:00:22|gp_dump-[INFO]:-Successfully launched Greenplum Database backup on dbid 1 server
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 1 on host greenplum01
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 9 on host greenplum03
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 7 on host greenplum03
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 6 on host greenplum03
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 8 on host greenplum03
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 2 on host greenplum02
20190319:03:00:22|gp_dump-[INFO]:-All remote gp_dump_agent processes have began transactions in serializable isolation level
20190319:03:00:22|gp_dump-[INFO]:-Waiting for remote gp_dump_agent processes to obtain local locks on dumpable objects
20190319:03:00:22|gp_dump-[INFO]:-All remote gp_dump_agent processes have obtains the necessary locks
20190319:03:00:22|gp_dump-[INFO]:-Committing transaction on the master database, thereby releasing locks.
20190319:03:00:22|gp_dump-[INFO]:-Waiting for all remote gp_dump_agent programs to finish.
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 5 on host greenplum02
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 3 on host greenplum02
20190319:03:00:22|gp_dump-[INFO]:-backup succeeded for dbid 4 on host greenplum02
20190319:03:00:22|gp_dump-[INFO]:-All remote gp_dump_agent programs are finished.
20190319:03:00:22|gp_dump-[INFO]:-Report results also written to /gpbackup/gp_dump_20190319030020.rpt.

Greenplum Database Backup Report
Timestamp Key: 20190319030020
gp_dump Command Line: -h 192.168.0.221 -p 5432 -U gpadmin -d postgres --gp-d /gpbackup/ --gp-r /gpbackup/
Pass through Command Line Options: -d
Compression Program: None
Backup Type: Full

Individual Results
    segment 7 (dbid 9) Host greenplum03 Port 6003 Database postgres BackupFile /gpbackup/gp_dump_7_9_20190319030020: Succeeded
    segment 6 (dbid 8) Host greenplum03 Port 6002 Database postgres BackupFile /gpbackup/gp_dump_6_8_20190319030020: Succeeded
    segment 5 (dbid 7) Host greenplum03 Port 6001 Database postgres BackupFile /gpbackup/gp_dump_5_7_20190319030020: Succeeded
    segment 4 (dbid 6) Host greenplum03 Port 6000 Database postgres BackupFile /gpbackup/gp_dump_4_6_20190319030020: Succeeded
    segment 3 (dbid 5) Host greenplum02 Port 6003 Database postgres BackupFile /gpbackup/gp_dump_3_5_20190319030020: Succeeded
    segment 2 (dbid 4) Host greenplum02 Port 6002 Database postgres BackupFile /gpbackup/gp_dump_2_4_20190319030020: Succeeded
    segment 1 (dbid 3) Host greenplum02 Port 6001 Database postgres BackupFile /gpbackup/gp_dump_1_3_20190319030020: Succeeded
    segment 0 (dbid 2) Host greenplum02 Port 6000 Database postgres BackupFile /gpbackup/gp_dump_0_2_20190319030020: Succeeded
    Master (dbid 1) Host greenplum01 Port 5432 Database postgres BackupFile /gpbackup/gp_dump_-1_1_20190319030020: Succeeded
    Master (dbid 1) Host greenplum01 Port 5432 Database postgres BackupFile /gpbackup/gp_dump_-1_1_20190319030020_post_data: Succeeded

gp_dump utility finished successfully.
[gpadmin@greenplum01 gpseg-1]$

02,並行備份(gpbackup)

  將數據庫的內容備份到元數據文件和數據文件的集合中,這些文件和數據文件可用於以后使用它來還原數據庫 gprestore默認情況下, gpbackup備份指定數據庫中的對象以及全局Greenplum數據庫系統對象。您可以選擇提供-globals 選項 gprestore恢復全局對象.

  gpbackup默認情況下,將對象元數據文件和DDL文件存儲在Greenplum數據庫主數據目錄中。Greenplum數據庫細分使用復制..關於部分命令將備份表的數據存儲在位於每個段的數據目錄中的壓縮CSV數據文件中。

  你可以添加 -backupdir選項將所有備份文件從Greenplum數據庫主節點和段主機復制到絕對路徑以供以后使用。提供了其他選項來過濾備份集以包含或排除特定表。

  每 gpbackup任務在Greenplum數據庫主控主機上使用單個事務。為每個段主機創建實用程序模式連接,以執行關聯復制..關於部分並行運作。備份過程獲取訪問分享 鎖定備份的每個表。

  gpbackup如果您將名為mail_contacts的文件放在 Greenplum數據庫超級用戶(gpadmin)的主目錄中或與該目錄相同的目錄中,則會備份操作完成后發送狀態電子郵件通知 gpbackup實用程序($ GPHOME / bin

   參數:

gpbackup is the parallel backup utility for Greenplum

Usage:
  gpbackup [flags]

Flags:
      --backup-dir string           The absolute path of the directory to which all backup files will be written
      --compression-level int       Level of compression to use during data backup. Valid values are between 1 and 9. (default 1)
      --data-only                   Only back up data, do not back up metadata
      --dbname string               The database to be backed up
      --debug                       Print verbose and debug log messages
      --exclude-schema strings      Back up all metadata except objects in the specified schema(s). --exclude-schema can be specifiedmultiple times.
      --exclude-table strings       Back up all metadata except the specified table(s). --exclude-table can be specified multiple times.
      --exclude-table-file string   A file containing a list of fully-qualified tables to be excluded from the backup
      --from-timestamp string       A timestamp to use to base the current incremental backup off
      --help                        Help for gpbackup
      --include-schema strings      Back up only the specified schema(s). --include-schema can be specified multiple times.
      --include-table strings       Back up only the specified table(s). --include-table can be specified multiple times.
      --include-table-file string   A file containing a list of fully-qualified tables to be included in the backup
      --incremental                 Only back up data for AO tables that have been modified since the last backup
      --jobs int                    The number of parallel connections to use when backing up data (default 1)
      --leaf-partition-data         For partition tables, create one data file per leaf partition instead of one data file for the whole table
      --metadata-only               Only back up metadata, do not back up data
      --no-compression              Disable compression of data files
      --plugin-config string        The configuration file to use for a plugin
      --quiet                       Suppress non-warning, non-error log messages
      --single-data-file            Back up all data to a single file instead of one per table
      --verbose                     Print verbose log messages
      --version                     Print version number and exit
      --with-stats                  Back up query plan statistics
 1 -dbname database_name
 2     需要。指定要備份的數據庫。
 3 -backupdir 目錄
 4     可選的。將所有必需的備份文件(元數據文件和數據文件)復制到指定的目錄。您必須將目錄指定為絕對路徑(不是相對路徑)。如果您不提供此選項,則會在$ MASTER_DATA_DIRECTORY / backups / YYYYMMDD / YYYYMMDDhhmmss / 目錄中的Greenplum Database主機上創建元數據文件 。段主機在<seg_dir> / backups / YYYYMMDD / YYYYMMDDhhmmss /目錄中創建CSV數據文件 。指定自定義備份目錄時,會將文件復制到備份目錄的子目錄中的這些路徑。
 5 -data只
 6     可選的。僅將表數據備份到CSV文件中,但不備份重新創建表和其他數據庫對象所需的元數據文件。
 7 -debug
 8     可選的。在操作期間顯示詳細的調試消息。
 9 -exclude-schema schema_name
10     可選的。指定要從備份中排除的數據庫模式。您可以多次指定此選項以排除多個模式。您無法將此選項與-include-模式選項。有關詳細信息,請參閱篩選備份的內容。
11 -exclude-table-file file_name
12     可選的。指定包含要從備份中排除的表列表的文本文件。文本文件中的每一行都必須使用該格式定義一個表 <模式名稱> <表名>。該文件不得包含尾隨行。如果表或模式名稱使用​​小寫字母,數字或下划線字符以外的任何字符,則必須在雙引號中包含該名稱。
13 您不能結合使用此選項 -leaf分區數據。雖然您可以在指定的文件中指定葉子分區名稱 -exclude表文件, gpbackup 忽略分區名稱。
14     有關 詳細信息,請參閱篩選備份的內容。
15 -include-schema schema_name
16     可選的。指定要包括在備份中的數據庫模式。您可以多次指定此選項以包含多個模式。如果指定此選項,則后續未包含的任何模式-include-模式備份集中省略了選項。您無法將此選項與 -exclude-模式選項。有關詳細信息,請參閱篩選備份的內容。
17 -include-table-file file_name
18     可選的。指定包含要包括在備份中的表列表的文本文件。文本文件中的每一行都必須使用該格式定義一個表 <模式名稱> <表名>。該文件不得包含尾隨行。如果表或模式名稱使用​​小寫字母,數字或下划線字符以外的任何字符,則必須在雙引號中包含該名稱。備份集中將省略此文件中未列出的任何表。
19 您可以選擇指定表葉子分區名稱來代替表名稱,以便在備份中僅包含特定葉子分區 -leaf分區數據 選項。
20 有關 詳細信息,請參閱篩選備份的內容。
21 --leaf-partition-data
22     可選的。對於分區表,為每個葉子分區創建一個數據文件,而不是為整個表創建一個數據文件(默認值)。使用此選項還可以指定要包含在備份中的單個葉子分區 -include表文件選項。您不能結合使用此選項-exclude表文件。
23 --metadata-only
24     可選的。僅創建重新創建數據庫對象所需的元數據文件(DDL),但不備份實際的表數據。
25 --no-compression
26     可選的。不要壓縮表數據CSV文件。
27 --quiet
28     可選的。禁止所有非警告,非錯誤日志消息。
29 -verbose
30     可選的。打印詳細日志消息。
31 --version
32     可選的。打印版本號並退出。
33 --with-stats
34     可選的。在備份集中包含查詢計划統計信息。
這里沒有東西!! >_<

  實例說明:

[gpadmin@greenplum01 gpbackup]$ gpbackup -dbname postgres
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Starting backup of database postgres
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Backup Timestamp = 20190319032758
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Backup Database = postgres
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Gathering table state information
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Acquiring ACCESS SHARE locks on tables
Locks acquired:  16 / 16 [==============================================================] 100.00% 0s
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Gathering additional table metadata
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Metadata will be written to /greenplum/data/master/gpseg-1/backups/20190319/20190319032758/gpbackup_20190319032758_metadata.sql
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Writing global database metadata
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Global database metadata backup complete
20190319:03:27:58 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Writing pre-data metadata
20190319:03:27:59 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Pre-data metadata backup complete
20190319:03:27:59 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Writing post-data metadata
20190319:03:27:59 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Post-data metadata backup complete
20190319:03:27:59 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Writing data to file
Tables backed up:  14 / 14 [============================================================] 100.00% 0s
20190319:03:27:59 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Skipped data backup of 2 external/foreign table(s).
20190319:03:27:59 gpbackup:gpadmin:greenplum01:018033-[INFO]:-See /home/gpadmin/gpAdminLogs/gpbackup_20190319.log for a complete listof skipped tables.
20190319:03:27:59 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Data backup complete
20190319:03:28:00 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Found neither /usr/local/greenplum-db/./bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20190319:03:28:00 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Email containing gpbackup report /greenplum/data/master/gpseg-1/backups/20190319/20190319032758/gpbackup_20190319032758_report will not be sent
20190319:03:28:00 gpbackup:gpadmin:greenplum01:018033-[INFO]:-Backup completed successfully

指定目錄備份:

[gpadmin@greenplum01 gpbackup]$ gpbackup -dbname demo --backup-dir /gpbackup/back1/
20190319:03:31:51 gpbackup:gpadmin:greenplum01:018642-[INFO]:-Starting backup of database demo
20190319:03:31:51 gpbackup:gpadmin:greenplum01:018642-[CRITICAL]:-FATAL: database "demo" does not exist (SQLSTATE 3D000)
[gpadmin@greenplum01 gpbackup]$ gpbackup -dbname gpdb --backup-dir /gpbackup/back1/
20190319:03:32:01 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Starting backup of database gpdb
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Backup Timestamp = 20190319033201
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Backup Database = gpdb
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Gathering table state information
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Acquiring ACCESS SHARE locks on tables
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Gathering additional table metadata
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[WARNING]:-No tables in backup set contain data. Performing metadata-only backup instead.
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Metadata will be written to /gpbackup/back1/gpseg-1/backups/20190319/20190319033201/gpbackup_20190319033201_metadata.sql
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Writing global database metadata
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Global database metadata backup complete
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Writing pre-data metadata
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Pre-data metadata backup complete
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Writing post-data metadata
20190319:03:32:02 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Post-data metadata backup complete
20190319:03:32:03 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Found neither /usr/local/greenplum-db/./bin/gp_email_contacts.yaml nor /home/gpadmin/gp_email_contacts.yaml
20190319:03:32:03 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Email containing gpbackup report /gpbackup/back1/gpseg-1/backups/20190319/20190319033201/gpbackup_20190319033201_report will not be sent
20190319:03:32:03 gpbackup:gpadmin:greenplum01:018677-[INFO]:-Backup completed successfully
[gpadmin@greenplum01 gpbackup]$
[gpadmin@greenplum01 gpbackup]$ ll /gpbackup/back1/gpseg-1/backups/20190319/20190319033201/
total 16
-r--r--r-- 1 gpadmin gpadmin  550 Mar 19 03:32 gpbackup_20190319033201_config.yaml
-r--r--r-- 1 gpadmin gpadmin 2377 Mar 19 03:32 gpbackup_20190319033201_metadata.sql
-r--r--r-- 1 gpadmin gpadmin 1452 Mar 19 03:32 gpbackup_20190319033201_report
-r--r--r-- 1 gpadmin gpadmin 3164 Mar 19 03:32 gpbackup_20190319033201_toc.yaml
[gpadmin@greenplum01 gpbackup]$

03,gpcrondump

   gpcrondump 實用程序將數據庫的內容轉儲為SQL腳本文件,然后可以使用它們在以后使用它來還原數據庫架構和用戶數據 gpdbrestore在轉儲操作期間,用戶仍將具有對數據庫的完全訪問權限。

   默認情況下,轉儲文件在其各自的主數據目錄和段數據目錄中的名稱中創建 db_dumps /YYYYMMDD默認使用壓縮數據轉儲文件gzip的

   該實用程序備份服務器配置參數的數據庫級設置 gp_default_storage_options, 優化,和SEARCH_PATH使用時還原數據庫時,將恢復設置gpdbrestore 實用程序並指定 -e 在執行還原操作之前創建空目標數據庫的選項。

           如果指定備份模式的選項,例如 -s, 要么 -S,即使它們不是特定於模式,也會備份數據庫中定義的所有過程語言。備份語言以支持可能備份的任何功能。不備份外語項,例如語言使用的共享庫。此外,如果指定僅備份表的選項,則不會備份語言,例如-t, -T

           備份操作完成后,該實用程序將檢查 gpcrondump SQL執行錯誤的狀態文件,如果發現錯誤則顯示警告。備份狀態文件的默認位置在 db_dumps / date / 目錄。

           如果指定包含或排除表或模式的選項,例如 -t, -T, -s, 要么 -S,備份表的模式限定名稱列在文件中 gp_dump_ timestamp _table該文件存儲在主段的備份目錄中。

    gpcrondump 允許您使用安排Greenplum數據庫的例行備份 cron的(UNIX操作系統的調度實用程序)。叫Cron的工作gpcrondump 應該在主控主機上安排。

  注意:

  Backing up a database with gpcrondump while simultaneously running ALTER 
TABLE might cause gpcrondump to fail.
  Backing up a database with gpcrondump while simultaneously running DDL 
commands might cause issues with locks. You might see either the DDL 
command or gpcrondump waiting to acquire locks.
  大概就是運行的時候更改表會備份失敗,運行DDL會產生鎖表問題

  回執碼:

About Return Codes

The following is a list of the codes that  gpcrondump returns.
  • 0 – Dump completed with no problems
  • 1 – Dump completed, but one or more warnings were generated
  • 2 – Dump failed with a fatal error

  參數: ---(英文更好看不翻譯了)

[gpadmin@greenplum01 gpbackup]$ gpcrondump --help
COMMAND NAME: gpcrondump

Writes out a database to SQL script files. The script files can be used
to restore the database using the gpdbrestore utility. The gpcrondump
utility can be called directly or from a crontab entry.

*****************************************************
SYNOPSIS
*****************************************************

gpcrondump -x database_name
     [-s <schema> | -S <schema> | -t <schema>.<table> | -T <schema>.<table>]
     [--table-file=<filename> | --exclude-table-file=<filename>]
     [--schema-file=<filename> | --exclude-schema-file=<filename>]
     [-u backup_directory] [-R post_dump_script] [--incremental]
     [ -K <timestamp> [--list-backup-files] ]
     [--prefix <prefix_string> [--list-filter-tables] ]
     [ -c  [ --cleanup-date yyyymmdd  |  --cleanup-total n ] ]
     [-z] [-r] [-f <free_space_percent>] [-b] [-h] [-H] [-j | -k]
     [-g] [-G] [-C] [-d <master_data_directory>] [-B <parallel_processes>]
     [-a] [-q] [-l <logfile_directory>]
     [--email-file <path_to_file> ] [-v]
     { [-E encoding] [--inserts | --column-inserts] [--oids]
     [--no-owner | --use-set-session-authorization]
     [--no-privileges] [--rsyncable]
     { [--ddboost [--replicate --max-streams <max_IO_streams>
     [--ddboost-skip-ping] ]
     [--ddboost-storage-unit=<storage_unit_name>] ] } |
     { [--netbackup-service-host <netbackup_server>
     --netbackup-policy <netbackup_policy>
     --netbackup-schedule <netbackup_schedule>
     [--netbackup-block-size <size> ]
     [--netbackup-keyword <keyword> ] } }

gpcrondump --ddboost-host <ddboost_hostname>
     [--ddboost-host ddboost_hostname ... ]
     --ddboost-user <ddboost_user>
     --ddboost-backupdir <backup_directory>
     [--ddboost-storage-unit=<storage_unit_name>]
     [--ddboost-remote] [--ddboost-skip-ping]

gpcrondump --ddboost-config-remove

gpcrondump --ddboost-show-config [--ddboost-remote]

gpcrondump -o  [ --cleanup-date yyyymmdd  |  --cleanup-total n ]

gpcrondump -?

gpcrondump --version


*****************************************************
DESCRIPTION
*****************************************************

The gpcrondump utility dumps the contents of a database into SQL script
files, which can then be used to restore the database schema and user
data at a later time using gpdbrestore. During a dump operation, users
will still have full access to the database.

By default, dump files are created in their respective master and
segment data directories in a directory named db_dumps/YYYYMMDD. The
data dump files are compressed by default using gzip.

gpcrondump allows you to schedule routine backups of a Greenplum
database using cron (a scheduling utility for UNIX operating systems).
Cron jobs that call gpcrondump should be scheduled on the master host.

WARNING: Backing up a database with gpcrondump while simultaneously
running ALTER TABLE might cause gpcrondump to fail.

**********************
Data Domain Boost
**********************

gpcrondump is used to schedule Data Domain Boost backup and restore
operations. gpcrondump is also used to set or remove one-time
credentials for Data Domain Boost.


**********************
NetBackup
**********************

Greenplum Database must be configured to communicate with the Symantec
NetBackup master server that is used to backup the database. See the
"Greenplum Database Administrator Guide" for information on
configuring Greenplum Database and NetBackup and backing up and
restoring with NetBackup.


**********************
Return Codes
**********************

The following is a list of the codes that gpcrondump returns.
   0 - Dump completed with no problems
   1 - Dump completed, but one or more warnings were generated
   2 - Dump failed with a fatal error


**********************
EMAIL NOTIFICATIONS
**********************

To have gpcrondump send email notifications with the completion status
after a back up operation completes, you must place a file named
mail_contacts in the home directory of the Greenplum superuser (gpadmin)
or in the same directory as the gpcrondump utility ($GPHOME/bin). This
file should contain one email address per line. gpcrondump will issue a
warning if it cannot locate a mail_contacts file in either location. If
both locations have a mail_contacts file, then the one in $HOME takes
precedence.

You can customize the email Subject and From lines of the email
notifications that gpcrondump sends after a back up completes for a
database. You specify the option --email-file with the location of a
YAML file that contains email Subject and From lines that gpcrondump
uses. See the section "File Format for Customized Emails" for
information about the format of the YAML file.

NOTE: The UNIX mail utility must be running on Greenplum Database host
and must be configured to allow the Greenplum superuser (gpadmin) to
send email.


**********************
Limitations
**********************

* NetBackup is not compatible with DDBoost. Both NetBackup and DDBoost
  cannot be used in a single back up operation.

* For incremental back up sets, a full backup and associated incremental
  backups, the backup set must be on a single device. For example, a
  backup set must all be on a file system. The backup set cannot have some
  backups on the local file system and others on a Data Domain system or a
  NetBackup system.


*****************************************************
OPTIONS
*****************************************************

-a

 Do not prompt the user for confirmation.(不要提示)


-b

 Bypass disk space check. The default is to check for available disk
 space, unless --ddboost is specified. When using Data Domain Boost, this
 option is always enabled.

 Note: Bypassing the disk space check generates a warning message. With a
 warning message, the return code for gpcrondump is 1 if the dump is
 successful. (If the dump fails, the return code is 2, in all cases.)
(繞過磁盤空間檢查會生成警告消息。帶有警告消息,返回代碼為gpcrondump 是 1如果轉儲成功。
(如果轉儲失敗,則返回代碼為
2, 在所有情況下。))
-B <parallel_processes> The number of segments to check in parallel for pre/post-dump validation. If not specified, the utility will start up to 60 parallel processes depending on how many segment instances it needs to dump. -c Specify this option to delete old backups before performing a back up. In the db_dumps directory, the directory where the name is the oldest date is deleted. If the directory name is the current date, the directory is not deleted. The default is to not delete old backup files. The deleted directory might contain files from one or more backups. WARNING: Before using this option, ensure that incremental backups required to perform the restore are not deleted. The gpdbrestore utility option --list-backup lists the backup sets required to perform a backup. You can specify the option --cleanup-date or --cleanup-total to specify backup sets to delete. If --ddboost is specified, only the old files on Data Domain Boost are deleted. This option is not supported with the -u option. -C Clean out the catalog schema prior to restoring database objects. gpcrondump adds the DROP command to the SQL script files when creating the backup files. When the script files are used by the gpdbrestore utility to restore database objects, the DROP commands remove existing database objects before restoring them. If --incremental is specified and the files are on NFS storage, the -C option is not supported. The database objects are not dropped if the -C option is specified. --cleanup-date=yyyymmdd Remove backup sets for the date yyyy-mm-dd. The date format is yyyymmdd. If multiple backup sets were created on the date, all the backup sets for that date are deleted. If no backup sets are found, gpcrondump returns a warning message and no backup sets are deleted. If the -c option is specified, the backup process continues. Valid only with the -c or -o option. WARNING: Before using this option, ensure that incremental backups required to perform the restore are not deleted. The gpdbrestore utility option --list-backup lists the backup sets required to perform a backup. --cleanup-total=n Remove the n oldest backup sets based on the backup timestamp. If there are fewer than n backup sets, gpcrondump returns a warning message and no backup sets are deleted. If the -c option is specified, the backup process continues. Valid only with the -c or -o option. WARNING: Before using this option, ensure that incremental backups required to perform the restore are not deleted. The gpdbrestore utility option --list-backup lists the backup sets required to perform a backup. --column-inserts Dump data as INSERT commands with column names. If --incremental is specified, this option is not supported. -d <master_data_directory> The master host data directory. If not specified, the value set for $MASTER_DATA_DIRECTORY will be used. --ddboost [--replicate --max-streams <max_IO_streams> [--ddboost-skip-ping] ] [--ddboost-storage-unit=<storage_unit_name>] Use Data Domain Boost for this backup. Before using Data Domain Boost, set up the Data Domain Boost credential, as described in the next option below. --ddboost-storage-unit is optional. Specify a Data Domain system storage unit name where a back up is stored. The storage unit name is also used to replicate dump files between source and target Data Domain systems if --ddboost-remote is specified. If --ddboost-storage-unit is not specified, it defaults to the value stored in the DD Boost config file for the Greenplum Database cluster. Note: storage unit will be created on DDBoost server only if one does not already exist and following options are not specified: --incremental, --list-backup-file, --list-filter-tables, -o, --ddboost-config-remove The following option is recommended if --ddboost is specified. * -z option (uncompressed) Backup compression (turned on by default) should be turned off with the -z option. Data Domain Boost will deduplicate and compress the backup data before sending it to the Data Domain system. --replicate --max-streams <max_IO_streams> is optional. If you specify this option, gpcrondump replicates the backup on the remote Data Domain server after the backup is complete on the primary Data Domain server. <max_IO_streams> specifies the maximum number of Data Domain I/O streams that can be used when replicating the backup set on the remote Data Domain server from the primary Data Domain server. You can use gpmfr to replicate a backup if replicating a backup with gpcrondump takes a long time and prevents other backups from occurring. Only one instance of gpcrondump can be running at a time. While gpcrondump is being used to replicate a backup, it cannot be used to create a backup. You can run a mixed backup that writes to both a local disk and Data Domain. If you want to use a backup directory on your local disk other than the default, use the -u option. Mixed backups are not supported with incremental backups. For more information about mixed backups and Data Domain Boost, see "Backing Up and Restoring Databases" in the "Greenplum Database Administrator Guide." IMPORTANT: Never use the Greenplum Database default backup options with Data Domain Boost. To maximize Data Domain deduplication benefits, retain at least 30 days of backups. NOTE: The -b, -c, -f, -G, -g, -R, and -u options change if --ddboost is specified. See the options for details. The DDBoost backup options are not supported if the NetBackup options are specified. --ddboost-host ddboost_hostname [--ddboost-host ddboost_hostname ... ] --ddboost-user <ddboost_user> --ddboost-backupdir <backup_directory> [--ddboost-storage-unit=<storage_unit_name>] [--ddboost-remote] [--ddboost-skip-ping] Sets the Data Domain Boost credentials. Do not combine this options with any other gpcrondump options. Do not enter just one part of this option. <ddboost_hostname> is the IP address (or hostname associated to the IP) of the host. There is a 30-character limit. If you use two or more network connections to connect to the Data Domain system, specify each connection with the --ddboost-host option. <ddboost_user> is the Data Domain Boost user name. There is a 30-character limit. <backup_directory> is the location for the backup files, configuration files, and global objects on the Data Domain system. The location on the system is GPDB/<backup_directory>. --ddboost-storage-unit is optional. Create or update the storage unit ID in the DD Boost credentials file. Default storage unit ID is GPDB. --ddboost-remote is optional. Indicates that the configuration parameters are for the remote Data Domain system that is used for backup replication Data Domain Boost managed file replication. If --ddboost-remote is specified, --ddboost-storage-unit is ignored. Example: gpcrondump --ddboost-host 172.28.8.230 --ddboost-user ddboostusername --ddboost-backupdir gp_production After running gpcrondump with these options, the system verifies the limits on the host and user names and prompts for the Data Domain Boost password. Enter the password when prompted; the password is not echoed on the screen. There is a 40-character limit on the password that can include lowercase letters (a-z), uppercase letters (A-Z), numbers (0-9), and special characters ($, %, #, +, etc.). The system verifies the password. After the password is verified, the system creates encrypted DDBOOST_CONFIG files in the user's home directory. In the example, the --ddboost-backupdir option specifies the backup directory gp_production in the Data Domain Storage Unit GPDB. NOTE: If there is more than one operating system user using Data Domain Boost for backup and restore operations, repeat this configuration process for each of those users. IMPORTANT: Set up the Data Domain Boost credential before running any Data Domain Boost backups with the --ddboost option, described above. --ddboost-config-remove Removes all Data Domain Boost credentials from the master and all segments on the system. Do not enter this option with any other gpcrondump option. --ddboost-show-config Show DDBoost and MFR (--ddboost-remote) related configuration information: DDBoost hostname, username, default backup directory, default storage unit. --ddboost-remote is optional, specify it to show the DDBoost and MFR related configuration information for remote DDBoost server. --ddboost-skip-ping Specify this option to skip the ping of a Data Domain system. When working with a Data Domain system, ping is used to ensure that the Data Domain system is reachable. If the Data Domain system is configured to block ICMP ping probes, specify this option. --dump-stats Dump optimizer statistics from pg_statistic. Statistics are dumped in the master data directory to db_dumps/YYYYMMDD/gp_statistics_1_1_<timestamp>. If --ddboost is specified, the backup is located on the storage unit specified by --ddboost-storge-unit, or by default, the storage unit from cluster's config file, under the default directory configured by --ddboost-backupdir when the Data Domain Boost credentials were set. -E <encoding> Character set encoding of dumped data. Defaults to the encoding of the database being dumped. See the Greenplum Database Reference Guide for the list of supported character sets. -email-file <path_to_file> Specify the fully-qualified location of the YAML file that contains the customized Subject and From lines that are used when gpcrondump sends notification emails about a database back up. See the section "File Format for Customized Emails" for information about the format of the YAML file. -f <free_space_percent> When checking that there is enough free disk space to create the dump files, specifies a percentage of free disk space that should remain after the dump completes. The default is 10 percent. NOTE: This is option is not supported if --ddboost or --incremental is specified. -g Secure a copy of the master and segment configuration files postgresql.conf, pg_ident.conf, and pg_hba.conf. These configuration files are dumped in the master or segment data directory to db_dumps/YYYYMMDD/config_files_<timestamp>.tar. If --ddboost is specified, the backup is located on the storage unit specified by --ddboost-storge-unit, or by default, the storage unit from cluster's config file, under the default directory configured by --ddboost-backupdir when the Data Domain Boost credentials were set. -G Use pg_dumpall to dump global objects such as roles and tablespaces. Global objects are dumped in the master data directory to db_dumps/YYYYMMDD/gp_global_1_1_<timestamp>. If --ddboost is specified, the backup is located on the storage unit specified by --ddboost-storge-unit, or by default, the storage unit from cluster's config file, under the default directory configured by --ddboost-backupdir when the Data Domain Boost credentials were set. -h Record details of database dump in database table public.gpcrondump_history in database supplied via -x option. Utility will create table if it does not currently exist. This option will be deprecated in a future release. -H Disable recording details of database dump in database table public.gpcrondump_history in database supplied via -x option. If not specified, the utility will create / update the public.gpcrondump_history table. -H option cannot be selected with -h option. --incremental Adds an incremental backup to a backup set. When performing an incremental backup, the complete backup set created prior to the incremental backup must be available. The complete backup set includes the following backup files: * The last full backup before the current incremental backup * All incremental backups created between the time of the full backup the current incremental backup An incremental backup is similar to a full back up except for append-optimized tables, including column-oriented tables. An append-optimized table is backed up only if at least one of the following operations was performed on the table after the last backup. ALTER TABLE INSERT UPDATE DELETE TRUNCATE DROP and then re-create the table For partitioned append-optimized tables, only the changed table partitions are backed up. The -u option must be used consistently within a backup set that includes a full and incremental backups. If you use the -u option with a full backup, you must use the -u option when you create incremental backups that are part of the backup set that includes the full backup. You can create an incremental backup for a full backup of set of database tables. When you create the full backup, specify the --prefix option to identify the backup. To include a set of tables in the full backup, use either the -t option or --table-file option. To exclude a set of tables, use either the -T option or the --exclude-table-file option. See the description of the option for more information on its use. To create an incremental backup based on the full backup of the set of tables, specify the option --incremental and the --prefix option with the string specified when creating the full backup. The incremental backup is limited to only the tables in the full backup. WARNING: gpcrondump does not check for available disk space prior to performing an incremental backup. IMPORTANT: An incremental back up set, a full backup and associated incremental backups, must be on a single device. For example, a the backups in a backup set must all be on a file system or must all be on a Data Domain system. --inserts Dump data as INSERT, rather than COPY commands. If --incremental is specified, this option is not supported. -j Run VACUUM before the dump starts. -K <timestamp> [--list-backup-files] Specify the <timestamp> that is used when creating a backup. The <timestamp> is 14-digit string that specifies a date and time in the format yyyymmddhhmmss. The date is used for backup directory name. The date and time is used in the backup file names. If -K <timestamp> is not specified, a timestamp is generated based on the system time. When adding a backup to set of backups, gpcrondump returns an error if the <timestamp> does not specify a date and time that is more recent than all other backups in the set. --list-backup-files is optional. When you specify both this option and the -K <timestamp> option, gpcrondump does not perform a backup. gpcrondump creates two text files that contain the names of the files that will be created when gpcrondump backs up a Greenplum database. The text files are created in the same location as the backup files. The file names use the timestamp specified by the -K <timestamp> option and have the suffix _pipes and _regular_files. For example: gp_dump_20130514093000_pipes gp_dump_20130514093000_regular_files The _pipes file contains a list of file names that be can be created as named pipes. When gpcrondump performs a backup, the backup files will generate into the named pipes. The _regular_files file contains a list of backup files that must remain regular files. gpcrondump and gpdbrestore use the information in the regular files during backup and restore operations. To backup a complete set of Greenplum Database backup files, the files listed in the _regular_files file must also be backed up after the completion of the backup job. To use named pipes for a backup, you need to create the named pipes on all the Greenplum Database and make them writeable before running gpcrondump. If --ddboost is specified, -K <timestamp> [--list-backup-files] is not supported. -k Run VACUUM after the dump has completed successfully. -l <logfile_directory> The directory to write the log file. Defaults to ~/gpAdminLogs. --netbackup-block-size <size> Specify the block size of data being transferred to the Symantec NetBackup server. The default is 512 bytes. NetBackup options are not supported if DDBoost backup options are specified. --netbackup-keyword <keyword> Specify a keyword for the backup that is transferred to the Symantec NetBackup server. NetBackup adds the keyword property and the specified <keyword> value to the NetBackup .img files that are created for the backup. The minimum length is 1 character, and the maximum length is 100 characters. NetBackup options are not supported if DDBoost backup options are specified. --netbackup-service-host netbackup_server The NetBackup master server that Greenplum Database connects to when backing up to NetBackup. NetBackup options are not supported if DDBoost backup options are specified. --netbackup-policy <netbackup_policy> The name of the NetBackup policy created for backing up Greenplum Database. NetBackup options are not supported if DDBoost backup options are specified.. --netbackup-schedule <netbackup_schedule> The name of the NetBackup schedule created for backing up Greenplum Database. NetBackup options are not supported if DDBoost backup options are specified. --no-owner Do not output commands to set object ownership. --no-privileges Do not output commands to set object privileges (GRANT/REVOKE commands). -o Clear out old dump files only, but do not run a dump. This will remove the oldest dump directory except the current date's dump directory. All dump sets within that directory will be removed. WARNING: Before using this option, ensure that incremental backups required to perform the restore are not deleted. The gpdbrestore utility option --list-backup lists the backup sets required to perform a restore. You can specify the option --cleanup-date or --cleanup-total to specify backup sets to delete. If --ddboost is specified, only the old files on Data Domain Boost are deleted. If --incremental is specified, this option is not supported. --oids Include object identifiers (oid) in dump data. If --incremental is specified, this option is not supported. --prefix <prefix_string> [--list-filter-tables ] Prepends <prefix_string> followed by an underscore character (_) to the names of all the backup files created during a backup. --list-filter-tables is optional. When you specify both options, gpcrondump does not perform a backup. For the full backup created by gpcrondump that is identified by the <prefix-string>, the tables that were included or excluded for the backup are listed. You must also specify the --incremental option if you specify the --list-filter-tables option. If --ddboost is specified, --prefix <prefix_string> [--list-filter-tables] is not supported. -q Run in quiet mode. Command output is not displayed on the screen, but is still written to the log file. -r Rollback the dump files (delete a partial dump) if a failure is detected. The default is to not rollback. Note: This option is not supported if --ddboost is specified. -R <post_dump_script> The absolute path of a script to run after a successful dump operation. For example, you might want a script that moves completed dump files to a backup host. This script must reside in the same location on the master and all segment hosts. --rsyncable Passes the --rsyncable flag to the gzip utility to synchronize the output occasionally, based on the input during compression. This synchronization increases the file size by less than 1% in most cases. When this flag is passed, the rsync(1) program can synchronize compressed files much more efficiently. The gunzip utility cannot differentiate between a compressed file created with this option, and one created without it. -s <schema_name> Dump all the tables that are qualified by the specified schema in the database. The -s option can be specified multiple times. System catalog schemas are not supported. If you want to specify multiple schemas, you can also use the --schema-file=<filename> option in order not to exceed the maximum token limit. Only a set of tables or set of schemas can be specified. For example, the -s option cannot be specified with the -t option. If --incremental is specified, this option is not supported. -S <schema_name> A schema name to exclude from the database dump. The -S option can be specified multiple times. If you want to specify multiple schemas, you can also use the --exclude-schema-file=<filename> option in order not to exceed the maximum token limit. Only a set of tables or set of schemas can be specified. For example, this option cannot be specified with the -t option. If --incremental is specified, this option is not supported. -t <schema>.<table> Dump only the named table in this database. The -t option can be specified multiple times. If you want to specify multiple tables, you can also use the --table-file=<filename> option in order not to exceed the maximum token limit. Only a set of tables or set of schemas can be specified. For example, this option cannot be specified with the -s option. If --incremental is specified, this option is not supported. -T <schema>.<table> A table name to exclude from the database dump. The -T option can be specified multiple times. If you want to specify multiple tables, you can also use the --exclude-table-file=<filename> option in order not to exceed the maximum token limit. Only a set of tables or set of schemas can be specified. For example, this option cannot be specified with the -s option. If --incremental is specified, this option is not supported. --exclude-schema-file=<filename> Excludes all the tables that are qualified by the specified schemas listed in the <filename> from the database dump. The file <filename> contains any number of schemas, listed one per line. Only a set of tables or set of schemas can be specified. For example, this option cannot be specified with the -t option. If --incremental is specified, this option is not supported. --exclude-table-file=<filename> Excludes all tables listed in the <filename> from the database dump. The file <filename> contains any number of tables, listed one per line. Only a set of tables or set of schemas can be specified. For example, this option cannot be specified with the -s option. If --incremental is specified, this option is not supported. --schema-file=<filename> Dumps only the tables that are qualified by the schemas listed in the <filename>. The file <filename> contains any number of schemas, listed one per line. Only a set of tables or set of schemas can be specified. For example, this option cannot be specified with the -t option. If --incremental is specified, this option is not supported. --table-file=<filename> Dumps only the tables listed in the <filename>. The file <filename> contains any number of tables, listed one per line. If --incremental is specified, this option is not supported. -u <backup_directory> Specifies the absolute path where the backup files will be placed on each host. If the path does not exist, it will be created, if possible. If not specified, defaults to the data directory of each instance to be backed up. Using this option may be desirable if each segment host has multiple segment instances as it will create the dump files in a centralized location rather than the segment data directories. Note: This option is not supported if --ddboost is specified. --use-set-session-authorization Use SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to set object ownership. -v | --verbose Specifies verbose mode. --version Displays the version of this utility. -x <database_name> Required. The name of the Greenplum database to dump. Specify multiple times for multiple databases. -z Do not use compression. Default is to compress the dump files using gzip. We recommend this option (-z) be used for NFS and Data Domain Boost backups. -? Displays the online help. ***************************************************** File Format for Customized Emails ***************************************************** You can configure gpcrondump to send an email notification after a back up operation completes for a database. To customize the From and Subject lines of the email that are sent for a database, you create a YAML file and specify the location of the file with the option --email-file. In the YAML file, you can specify a different From and Subject line for each database that gpcrondump backs up. This is the format of the YAML file to specify a custom From and Subject line for a database: EMAIL_DETAILS: - DBNAME: <database_name> FROM: <from_user> SUBJECT: <subject_text> When email notification is configured for gpcrondump, the <from_user> and the <subject_text> are the strings that gpcrondump uses in the email notification after completing the back up for <database_name>. This example YAML file specifies different From and Subject lines for the databases testdb100 and testdb200. EMAIL_DETAILS: - DBNAME: testdb100 FROM: RRP_MPE2_DCA_1 SUBJECT: backup completed for Database 'testdb100' - DBNAME: testdb200 FROM: Report_from_DCDDEV_host SUBJECT: Completed backup for database 'testdb200' ***************************************************** EXAMPLES ***************************************************** Call gpcrondump directly and dump mydatabase (and global objects): gpcrondump -x mydatabase -c -g -G A crontab entry that runs a backup of the sales database (and global objects) nightly at one past midnight: 01 0 * * * /home/gpadmin/gpdump.sh >> gpdump.log The content of dump script gpdump.sh is: #!/bin/bash export GPHOME=/usr/local/greenplum-db export MASTER_DATA_DIRECTORY=/data/gpdb_p1/gp-1 . $GPHOME/greenplum_path.sh gpcrondump -x sales -c -g -G -a -q This example creates two text files, one with the suffix _pipes and the other with _regular_files. The _pipes file contain the file names that can be named pipes when you backup the Greenplum database mytestdb. gpcrondump -x mytestdb -K 20131030140000 --list-backup-files To use incremental backup with a set of database tables, you must create a full backup of the set of tables and specify the --prefix option to identify the backup set. The following example uses the --table-file option to create a full backup of the set of files listed in the file user-tables. The prefix user_backup identifies the backup set. gpcrondump -x mydatabase --table-file=user-tables --prefix user_backup To create an incremental backup for the full backup created in the previous example, specify the --incremental option and the option --prefix user_backup to identify backup set. This example creates an incremental backup. gpcrondump -x mydatabase --incremental --prefix user_backup This command lists the tables that were included or excluded for the full backup. gpcrondump -x mydatabase --incremental --prefix user_backup --list-filter-tables This command backs up the database customer and specifies a NetBackup policy and schedule that are defined on the NetBackup master server nbu_server1. A block size of 1024 bytes is used to transfer data to the NetBackup server. gpcrondump -x customer --netbackup-service-host=nbu_server1 --netbackup-policy=gpdb_cust --netbackup-schedule=gpdb_backup --netbackup-block-size=1024 ***************************************************** SEE ALSO ***************************************************** gpdbrestore

---具體操作見下章---

四,三個軟件 的認識

  備份軟件這么多不可能全部都跑一遍把,這種東西不現實:

  所以的優缺點就出來了

  gp_dump --->這個被官方給XXOO了,為啥呢,太慢了,備份慢,連恢復也慢!!

  替代他的是gpcrondump  這個底層還是gp_dump 但是更加厲害了,備份可以備份配置文件

  后來居上的gpbackup新的東西,就是快!

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM