在 pg_basebackup 命令 Postgres 中排除文件的选项
Option to exclude files in pg_basebackup command Postgres
克隆备用数据库时,如何防止pg_basebackup从主数据库复制postgresql.conf和pg_hba.conf到/var/lib/pgsql/9.9/data目录?
目前我正在使用这个命令
[root@xyz..]# pg_basebackup -h {master ipAddr} -D /var/lib/pgsql/9.6/data -U postgres -v -P
The backup will include all files in the data directory and
tablespaces, including the configuration files and any additional
files placed in the directory by third parties. But only regular files
and directories are copied. Symbolic links (other than those used for
tablespaces) and special device files are skipped.
所以没有这个选项。如果您仍然想强制执行它,请将配置文件从数据目录中移开(并且可以选择 ln
它们到 data_dir)
此答案适用于 Postgres 14。pg_basebackup
备份整个数据目录。 https://www.postgresql.org/docs/14/app-pgbasebackup.html 声明备份实用程序将跳过所有 directory/file 符号链接。因此,这可能是一种解决方法,可以只将需要的内容放入 tar 球中。
我遇到过类似的情况,我想排除多个目录的内容,如 pg_replslot,pg_dynshmem, pg_notify
等。我用通常的方式制作了 tar 球:pg_basebackup -D /backup/ -F t -P -v
。 tar 球制作完成后,在将其恢复到另一台服务器之前,我通过排除所有必需目录的内容手动更新了 tar。
克隆备用数据库时,如何防止pg_basebackup从主数据库复制postgresql.conf和pg_hba.conf到/var/lib/pgsql/9.9/data目录?
目前我正在使用这个命令
[root@xyz..]# pg_basebackup -h {master ipAddr} -D /var/lib/pgsql/9.6/data -U postgres -v -P
The backup will include all files in the data directory and tablespaces, including the configuration files and any additional files placed in the directory by third parties. But only regular files and directories are copied. Symbolic links (other than those used for tablespaces) and special device files are skipped.
所以没有这个选项。如果您仍然想强制执行它,请将配置文件从数据目录中移开(并且可以选择 ln
它们到 data_dir)
此答案适用于 Postgres 14。pg_basebackup
备份整个数据目录。 https://www.postgresql.org/docs/14/app-pgbasebackup.html 声明备份实用程序将跳过所有 directory/file 符号链接。因此,这可能是一种解决方法,可以只将需要的内容放入 tar 球中。
我遇到过类似的情况,我想排除多个目录的内容,如 pg_replslot,pg_dynshmem, pg_notify
等。我用通常的方式制作了 tar 球:pg_basebackup -D /backup/ -F t -P -v
。 tar 球制作完成后,在将其恢复到另一台服务器之前,我通过排除所有必需目录的内容手动更新了 tar。