pg_basebackup物理备份常用参数速查参数简写说明示例--pgdataDIRECTORY-D备份目标目录必需-D /backup/base--formatp|t-F输出格式plain|tar-Fp或-Ft--wal-methodMETHOD-XWAL 处理方式-Xs流复制--checkpointfast|spread检查点模式--checkpointfast--progress-P显示进度-P--verbose-v详细输出-v--jobsNUM-j并行压缩/传输-j 4--compressMETHOD-z压缩方法-z 9--hostHOSTNAME-h主机地址-h 192.168.1.1--portPORT-p端口-p 5432--usernameNAME-U用户名-U rep--no-password-w不提示密码-w--password-W强制提示密码-Wpg_basebackup takes a base backup of a running PostgreSQL server. Usage: pg_basebackup [OPTION]... Options controlling the output: -D, --pgdataDIRECTORY receive base backup into directory -F, --formatp|t output format (plain (default), tar) -r, --max-rateRATE maximum transfer rate to transfer data directory (in kB/s, or use suffix k or M) -R, --write-recovery-conf write configuration for replication -t, --targetTARGET[:DETAIL] backup target (if other than client) -T, --tablespace-mappingOLDDIRNEWDIR relocate tablespace in OLDDIR to NEWDIR --waldirWALDIR location for the write-ahead log directory -X, --wal-methodnone|fetch|stream include required WAL files with specified method -z, --gzip compress tar output -Z, --compress[{client|server}-]METHOD[:DETAIL] compress on client or server as specified -Z, --compressnone do not compress tar output General options: -c, --checkpointfast|spread set fast or spread checkpointing -C, --create-slot create replication slot -l, --labelLABEL set backup label -n, --no-clean do not clean up after errors -N, --no-sync do not wait for changes to be written safely to disk -P, --progress show progress information -S, --slotSLOTNAME replication slot to use -v, --verbose output verbose messages -V, --version output version information, then exit --manifest-checksumsSHA{224,256,384,512}|CRC32C|NONE use algorithm for manifest checksums --manifest-force-encode hex encode all file names in manifest --no-estimate-size do not estimate backup size in server side --no-manifest suppress generation of backup manifest --no-slot prevent creation of temporary replication slot --no-verify-checksums do not verify checksums -?, --help show this help, then exit Connection options: -d, --dbnameCONNSTR connection string -h, --hostHOSTNAME database server host or socket directory -p, --portPORT database server port number -s, --status-intervalINTERVAL time between status packets sent to server (in seconds) -U, --usernameNAME connect as specified database user -w, --no-password never prompt for password -W, --password force password prompt (should happen automatically) Report bugs to pgsql-bugslists.postgresql.org. PostgreSQL home page: https://www.postgresql.org/示例常用备份语法pg_basebackup -D /opt/pg_basebackup/$(date %Y%m%d_%H%M%S) -Fp -Xs -P -v -U rep -h 192.168.0.3pg_basebackup -D /opt/pg_basebackup/$(date %Y%m%d_%H%M%S) -Ft -Xs -P -v -U rep -h 192.168.0.3backup_manifestpg_dump常用参数速查参数说明示例-d, --dbnameDBNAME指定数据库-d mydb-U, --usernameNAME用户名-U postgres-h, --hostHOSTNAME主机地址-h 127.0.0.1-p, --portPORT端口-p 5432-f, --fileFILENAME输出文件替代 -f backup.sql-F, --formatc|d|t|p输出格式-Fc-v, --verbose详细输出-v-W, --password强制提示密码-W-w, --no-password从不提示密码-wpg_dump dumps a database as a text file or to other formats. Usage: pg_dump [OPTION]... [DBNAME] General options: -f, --fileFILENAME output file or directory name/输出文件名或目录名 -F, --formatc|d|t|p output file format (custom, directory, tar, plain text (default)) -j, --jobsNUM use this many parallel jobs to dump -v, --verbose verbose mode -V, --version output version information, then exit -Z, --compressMETHOD[:DETAIL] compress as specified --lock-wait-timeoutTIMEOUT fail after waiting TIMEOUT for a table lock --no-sync do not wait for changes to be written safely to disk -?, --help show this help, then exit Options controlling the output content: -a, --data-only dump only the data, not the schema -b, --large-objects include large objects in dump --blobs (same as --large-objects, deprecated) -B, --no-large-objects exclude large objects in dump --no-blobs (same as --no-large-objects, deprecated) -c, --clean clean (drop) database objects before recreating -C, --create include commands to create database in dump -e, --extensionPATTERN dump the specified extension(s) only -E, --encodingENCODING dump the data in encoding ENCODING -n, --schemaPATTERN dump the specified schema(s) only -N, --exclude-schemaPATTERN do NOT dump the specified schema(s) -O, --no-owner skip restoration of object ownership in plain-text format -s, --schema-only dump only the schema, no data -S, --superuserNAME superuser user name to use in plain-text format -t, --tablePATTERN dump only the specified table(s) -T, --exclude-tablePATTERN do NOT dump the specified table(s) -x, --no-privileges do not dump privileges (grant/revoke) --binary-upgrade for use by upgrade utilities only --column-inserts dump data as INSERT commands with column names --disable-dollar-quoting disable dollar quoting, use SQL standard quoting --disable-triggers disable triggers during>示例pg_dump -U postgres -d demo1 $(date %Y%m%d_%H%M%S).sql