描述:
pg_basebackup是日常使用最多的物理备份方式,使用方式非常简单,本文梳理11.7版本下日常操作。
一、概念
pg_basebackup被用于获得一个正在运行的PostgreSQL数据库集簇的基础备份。获得这些备份不会影响连接到该数据库的其他客户端,并且可以被用于时间点恢复以及用作一个日志传送或流复制后备服务器的开始点。只能用作全实例备份,不能单独备份某个数据库。
二、参数介绍
输出控制参数:
| 简指令 | 全指令 | 解释及建议 |
| -D | --pgdata=DIRECTORY | 接收存放备份文件目录,必选参数 |
| -F | --format=p|t | 备份文件输出格式,默认plain平面文件,日常运维为了节省空间和传输方便都会使用tar包格式 |
| -r | --max-rate=RATE | 传输速度,远程备份时候需要注意使用,防止网络带宽被拉满而影响生产环境 |
| -R | --write-recovery-conf | 是否输出recovery-conf文件,方便后续使用备份快速搭建出从节点 |
| -T | --tablespace-mapping=OLDDIR=NEWDIR --waldir=WALDIR |
|
| -X | --wal-method=none|fetch|stream | 指定wal日志接收模式 |
| -z | --gzip | 是否压缩 |
| -Z | --compress=0-9 | 压缩等级执行,平衡空间和时间一般选择级别5 |
通用参数:
| 简指令 | 全指令 | 解释及建议 |
| -c | --checkpoint=fast|spread | 指定备份时执行checkpoint的模式,默认是调度模式(spread),如果使用非调度模式(fast),将尽快完成检查点,会全速刷脏,脏页特别多会对其他会话的性能有影响。除非对环境非常了解,不建议使用非调度模式(fast)。 |
| -C | --create-slot | 备份开始前,创建复制槽点 |
| -l | --label=LABEL | 给备份创建一个标签,就是pg_start_backup(lable)函数的参数 |
| -n | --no-clean | 在备份发送错误后,不去清理备份目录,一般用于调试 |
| -N | --no-sync | 默认情况下将等待所有文件被安全地写到磁盘上,如果使用该参数将加快备份,但是在生产环境不建议使用 |
| -P | --progress | 启用进度报告,可以直观的看到备份进度,但因为计算备份内容会稍微增加备份时间 |
| -S | --slot=SLOTNAME | 指定使用复制槽,不能和创建复制槽一起使用 |
| -v | --verbose | 启用冗长模式,显示更加详细的输出 |
| -V | --version --no-slot --no-verify-checksums |
|
连接参数:
| 简指令 | 全指令 | 解释及建议 |
| -d | --dbname=CONNSTR | 以一个连接字符串的形式指定用于连接到服务器的参数,用来标注作用(为了和其他客户端应用一致,该选项被称为--dbname。但是因为pg_basebackup并不连接到集簇中的任何特定数据库,连接字符串中的数据库名将被忽略) |
| -h | --host=HOSTNAME | 指定运行服务器的机器的主机名,没有指定或者使用斜线会默认Unix 域套接字连接 |
| -p | --port=PORT | 指定服务器正在监听连接的 TCP 端口或本地 Unix 域套接字文件扩展 |
| -s | --status-interval=INTERVAL | 指定发送回服务器的状态包之间的秒数 |
| -U | --username=NAME | 连接用户 |
| -w | --no-password | 不发送密码。如果服务器要求口令认证并且没有其他方式提供口令(例如一个.pgpass文件),那连接尝试将失败。批量脚本会使用 |
| -W | --password | 强制在连接到一个数据库之前提示要求一个口令。这个选项不是必不可少的,因为如果服务器要求口令认证,将自动提示要求一个口令 |
三、wal日志fetch模式和stream模式备份差异
1、fetch模式
wal日志和数据文件备份串行备份,备份开始时记录wal开始点,在数据文件备份完成后,从wal日志的开始点和结束点一次性写入到文件中。
优点:日志文件目录和数据文件压缩在同一目录。
缺点:备份开始时刻的日志需要一直保存下来,也就说pg的wal_keep_segments需要足够大去保存日志文件,如果备份数据期间,日志开始时刻的日志已经被移除,那么备份就会失败。
所以一般情况下备份不会使用fetch模式。
备份后目录情况:
压缩包(wal日志未单独生成压缩包,24578.tar.gz是自定义表空间)
[postgres@c7slave backup]$ pg_basebackup -Upostgres -Ft -Pv -Xf -z -Z5 -p 6543 -D data/backup/pg_basebackup: initiating base backup, waiting for checkpoint to completepg_basebackup: checkpoint completedpg_basebackup: write-ahead log start point: 0/21000028 on timeline 165416/65416 kB (100%), 2/2 tablespacespg_basebackup: write-ahead log end point: 0/210000F8pg_basebackup: base backup completed[postgres@c7slave backup]$ lltotal 7508-rw------- 1 postgres postgres 272 May 23 05:46 24578.tar.gz-rw------- 1 postgres postgres 7681340 May 23 05:46 base.tar.gz
解压base.tar.gz (wal日志包含在base中pg_wal目录)
[postgres@c7slave backup]$ tar -zxf base.tar.gz[postgres@c7slave backup]$ lltotal 4008-rw------- 1 postgres postgres 272 May 23 05:46 24578.tar.gz-rw------- 1 postgres postgres 226 May 23 05:46 backup_label-rw------- 1 postgres postgres 226 May 14 04:31 backup_label.olddrwx------ 6 postgres postgres 54 Apr 17 22:42 base-rw------- 1 postgres postgres 4043367 May 14 04:31 base.tar.gz-rw------- 1 postgres postgres 44 May 23 03:30 current_logfilesdrwx------ 2 postgres postgres 4096 May 23 05:46 globaldrwx------ 2 postgres postgres 4096 May 23 03:30 logdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_commit_tsdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_dynshmem-rw------- 1 postgres postgres 4540 May 13 02:14 pg_hba.conf-rw------- 1 postgres postgres 1636 Apr 17 22:35 pg_ident.confdrwx------ 4 postgres postgres 68 May 23 05:46 pg_logicaldrwx------ 4 postgres postgres 36 Apr 17 22:35 pg_multixactdrwx------ 2 postgres postgres 6 May 14 04:36 pg_notifydrwx------ 2 postgres postgres 6 May 23 05:45 pg_replslotdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_serialdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_snapshotsdrwx------ 2 postgres postgres 6 May 13 02:14 pg_statdrwx------ 2 postgres postgres 6 May 23 05:45 pg_stat_tmpdrwx------ 2 postgres postgres 6 May 21 02:00 pg_subtransdrwx------ 2 postgres postgres 6 May 14 04:36 pg_tblspcdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_twophase-rw------- 1 postgres postgres 3 Apr 17 22:35 PG_VERSIONdrwx------ 3 postgres postgres 60 May 23 05:46 pg_waldrwx------ 2 postgres postgres 18 Apr 17 22:35 pg_xact-rw------- 1 postgres postgres 219 May 13 02:54 postgresql.auto.conf-rw------- 1 postgres postgres 665 Apr 28 02:31 postgresql.conf-rw------- 1 postgres postgres 21 May 23 05:46 tablespace_map-rw------- 1 postgres postgres 21 May 14 04:31 tablespace_map.old[postgres@c7slave backup]$ ll pg_wal/*-rw------- 1 postgres postgres 16777216 May 23 05:46 pg_wal/000000010000000000000021pg_wal/archive_status:total 0-rw------- 1 postgres postgres 0 May 23 05:46 000000010000000000000021.done
2、stream模式(建议使用)
wal日志和数据文件备份并行备份,这就要求wal_max_sender必须保证不小于2,两个进程在备份开始时分别接收数据文件和wal日志,最后生成两个压缩文件。
优点:不会出现fetch模式因wal_keep_segments不够而失败,并且并行备份,备份速度得到提升,尤其在高吞吐的环境中。
缺点:wal日志和数据文件分开存放,在备份恢复时,需要手工去移动文件夹
备份目录情况:
压缩包(wal日志单独生成压缩包,24578.tar.gz是自定义表空间)
[postgres@c7slave backup]$ pg_basebackup -Upostgres -Ft -Pv -Xs -z -Z5 -p 6543 -D data/backup/pg_basebackup: initiating base backup, waiting for checkpoint to completepg_basebackup: checkpoint completedpg_basebackup: write-ahead log start point: 0/23000028 on timeline 1pg_basebackup: starting background WAL receiverpg_basebackup: created temporary replication slot "pg_basebackup_37954"45097/45097 kB (100%), 2/2 tablespacespg_basebackup: write-ahead log end point: 0/230000F8pg_basebackup: waiting for background process to finish streaming ...pg_basebackup: base backup completed[postgres@c7slave backup]$ lltotal 3992-rw------- 1 postgres postgres 272 May 23 06:07 24578.tar.gz-rw------- 1 postgres postgres 4060364 May 23 06:07 base.tar.gz-rw------- 1 postgres postgres 17071 May 23 06:07 pg_wal.tar.gz
解压base.tar.gz(base中pg_wal目录没有wal日志)
[postgres@c7slave backup]$ lltotal 4036-rw------- 1 postgres postgres 272 May 23 06:07 24578.tar.gz-rw------- 1 postgres postgres 226 May 23 06:07 backup_labeldrwx------ 6 postgres postgres 54 Apr 17 22:42 base-rw------- 1 postgres postgres 4060364 May 23 06:07 base.tar.gz-rw------- 1 postgres postgres 44 May 23 03:30 current_logfilesdrwx------ 2 postgres postgres 4096 May 23 06:08 globaldrwx------ 2 postgres postgres 4096 May 23 03:30 logdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_commit_tsdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_dynshmem-rw------- 1 postgres postgres 4540 May 13 02:14 pg_hba.conf-rw------- 1 postgres postgres 1636 Apr 17 22:35 pg_ident.confdrwx------ 4 postgres postgres 68 May 23 06:07 pg_logicaldrwx------ 4 postgres postgres 36 Apr 17 22:35 pg_multixactdrwx------ 2 postgres postgres 6 May 14 04:36 pg_notifydrwx------ 2 postgres postgres 6 May 23 06:07 pg_replslotdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_serialdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_snapshotsdrwx------ 2 postgres postgres 6 May 13 02:14 pg_statdrwx------ 2 postgres postgres 6 May 23 06:07 pg_stat_tmpdrwx------ 2 postgres postgres 6 May 21 02:00 pg_subtransdrwx------ 2 postgres postgres 6 May 14 04:36 pg_tblspcdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_twophase-rw------- 1 postgres postgres 3 Apr 17 22:35 PG_VERSIONdrwx------ 3 postgres postgres 28 May 23 06:08 pg_wal-rw------- 1 postgres postgres 17071 May 23 06:07 pg_wal.tar.gzdrwx------ 2 postgres postgres 18 Apr 17 22:35 pg_xact-rw------- 1 postgres postgres 219 May 13 02:54 postgresql.auto.conf-rw------- 1 postgres postgres 665 Apr 28 02:31 postgresql.conf-rw------- 1 postgres postgres 21 May 23 06:07 tablespace_map[postgres@c7slave backup]$ ll pg_wal/*total 0[postgres@c7slave backup]$ cd pg_wal[postgres@c7slave pg_wal]$ lltotal 0drwx------ 2 postgres postgres 6 May 23 06:07 archive_status
四、自定义表空间备份注意点
备份后,自定义表空间将会以表空间id号作为文件名,单独压缩
[postgres@c7slave backup]$ pg_basebackup -Upostgres -Ft -Pv -Xs -z -Z5 -p 6543 -D data/backup/pg_basebackup: initiating base backup, waiting for checkpoint to completepg_basebackup: checkpoint completedpg_basebackup: write-ahead log start point: 0/25000028 on timeline 1pg_basebackup: starting background WAL receiverpg_basebackup: created temporary replication slot "pg_basebackup_38005"45101/45101 kB (100%), 2/2 tablespacespg_basebackup: write-ahead log end point: 0/250000F8pg_basebackup: waiting for background process to finish streaming ...pg_basebackup: base backup completed[postgres@c7slave backup]$ lltotal 3992-rw------- 1 postgres postgres 272 May 23 06:13 24578.tar.gz-rw------- 1 postgres postgres 4060721 May 23 06:13 base.tar.gz-rw------- 1 postgres postgres 17068 May 23 06:13 pg_wal.tar.gz
备份后,自定义表空间目录的系统文件目录记录在tablespace_map文件中
[postgres@c7slave backup]$ tar -zxf base.tar.gz[postgres@c7slave backup]$ lltotal 4036-rw------- 1 postgres postgres 272 May 23 06:13 24578.tar.gz-rw------- 1 postgres postgres 226 May 23 06:13 backup_labeldrwx------ 6 postgres postgres 54 Apr 17 22:42 base-rw------- 1 postgres postgres 4060721 May 23 06:13 base.tar.gz-rw------- 1 postgres postgres 44 May 23 03:30 current_logfilesdrwx------ 2 postgres postgres 4096 May 23 06:16 globaldrwx------ 2 postgres postgres 4096 May 23 03:30 logdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_commit_tsdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_dynshmem-rw------- 1 postgres postgres 4540 May 13 02:14 pg_hba.conf-rw------- 1 postgres postgres 1636 Apr 17 22:35 pg_ident.confdrwx------ 4 postgres postgres 68 May 23 06:13 pg_logicaldrwx------ 4 postgres postgres 36 Apr 17 22:35 pg_multixactdrwx------ 2 postgres postgres 6 May 14 04:36 pg_notifydrwx------ 2 postgres postgres 6 May 23 06:13 pg_replslotdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_serialdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_snapshotsdrwx------ 2 postgres postgres 6 May 13 02:14 pg_statdrwx------ 2 postgres postgres 6 May 23 06:12 pg_stat_tmpdrwx------ 2 postgres postgres 6 May 21 02:00 pg_subtransdrwx------ 2 postgres postgres 6 May 14 04:36 pg_tblspcdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_twophase-rw------- 1 postgres postgres 3 Apr 17 22:35 PG_VERSIONdrwx------ 3 postgres postgres 28 May 23 06:16 pg_wal-rw------- 1 postgres postgres 17068 May 23 06:13 pg_wal.tar.gzdrwx------ 2 postgres postgres 18 Apr 17 22:35 pg_xact-rw------- 1 postgres postgres 219 May 13 02:54 postgresql.auto.conf-rw------- 1 postgres postgres 665 Apr 28 02:31 postgresql.conf-rw------- 1 postgres postgres 21 May 23 06:13 tablespace_map[postgres@c7slave backup]$ cat tablespace_map24578 /data/newspace
恢复的时候需要手动创建相应的目录,并且将相应的文件移动过去
五、备份恢复案例
全量备份:
pg_basebackup -Upostgres -Ft -Pv -Xs -z -Z5 -p 6543 -D data/backup/$(date +%F)
[postgres@c7slave backup]$ pg_basebackup -Upostgres -Ft -Pv -Xs -z -Z5 -p 6543 -D data/backup/$(date +%F)pg_basebackup: initiating base backup, waiting for checkpoint to completepg_basebackup: checkpoint completedpg_basebackup: write-ahead log start point: 0/29000028 on timeline 1pg_basebackup: starting background WAL receiverpg_basebackup: created temporary replication slot "pg_basebackup_38099"45110/45110 kB (100%), 2/2 tablespacespg_basebackup: write-ahead log end point: 0/290000F8pg_basebackup: waiting for background process to finish streaming ...pg_basebackup: base backup completed[postgres@c7slave backup]$ lltotal 0drwx------ 2 postgres postgres 66 May 23 06:25 2020-05-23[postgres@c7slave backup]$ cd 2020-05-23/[postgres@c7slave 2020-05-23]$ lltotal 3992-rw------- 1 postgres postgres 272 May 23 06:25 24578.tar.gz-rw------- 1 postgres postgres 4061462 May 23 06:25 base.tar.gz-rw------- 1 postgres postgres 17070 May 23 06:25 pg_wal.tar.gz
全量恢复
1、关闭数据库
[postgres@c7slave backup]$ pg_ctl stopwaiting for server to shut down.... doneserver stopped
2、备份原data目录和自定义表空间目录(生产一定备份,最后一条路哦)
[postgres@c7slave ~]$ cd $PGDATA[postgres@c7slave data]$ pwd/data/pg11/data[postgres@c7slave data]$ cd ..[postgres@c7slave pg11]$ lltotal 4drwx------ 20 postgres postgres 4096 May 23 06:30 data[postgres@c7slave pg11]$ mv data data.bak20200523
3、创建新data目录
[postgres@c7slave pg11]$ mkdir data[postgres@c7slave pg11]$ lltotal 4drwxrwxr-x 2 postgres postgres 6 May 23 06:33 datadrwx------ 20 postgres postgres 4096 May 23 06:30 data.bak20200523
4、将备份文件迁移到新data文件中
drwxr-xr-x 4 postgres postgres 42 May 23 06:33 pg11[postgres@c7slave data]$ cp data/backup/2020-05-23/* $PGDATA/[postgres@c7slave data]$ cd $PGDATA[postgres@c7slave data]$ lltotal 3992-rw------- 1 postgres postgres 272 May 23 06:40 24578.tar.gz-rw------- 1 postgres postgres 4061462 May 23 06:40 base.tar.gz-rw------- 1 postgres postgres 17070 May 23 06:40 pg_wal.tar.gz
5、解压base.tar.gz
[postgres@c7slave data]$ tar -zxf base.tar.gz[postgres@c7slave data]$ lltotal 4036-rw------- 1 postgres postgres 272 May 23 06:40 24578.tar.gz-rw------- 1 postgres postgres 226 May 23 06:25 backup_labeldrwx------ 6 postgres postgres 54 Apr 17 22:42 base-rw------- 1 postgres postgres 4061462 May 23 06:40 base.tar.gz-rw------- 1 postgres postgres 44 May 23 03:30 current_logfilesdrwx------ 2 postgres postgres 4096 May 23 06:41 globaldrwx------ 2 postgres postgres 4096 May 23 03:30 logdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_commit_tsdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_dynshmem-rw------- 1 postgres postgres 4540 May 13 02:14 pg_hba.conf-rw------- 1 postgres postgres 1636 Apr 17 22:35 pg_ident.confdrwx------ 4 postgres postgres 68 May 23 06:25 pg_logicaldrwx------ 4 postgres postgres 36 Apr 17 22:35 pg_multixactdrwx------ 2 postgres postgres 6 May 14 04:36 pg_notifydrwx------ 2 postgres postgres 6 May 23 06:25 pg_replslotdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_serialdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_snapshotsdrwx------ 2 postgres postgres 6 May 13 02:14 pg_statdrwx------ 2 postgres postgres 6 May 23 06:24 pg_stat_tmpdrwx------ 2 postgres postgres 6 May 21 02:00 pg_subtransdrwx------ 2 postgres postgres 6 May 14 04:36 pg_tblspcdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_twophase-rw------- 1 postgres postgres 3 Apr 17 22:35 PG_VERSIONdrwx------ 3 postgres postgres 28 May 23 06:41 pg_wal-rw------- 1 postgres postgres 17070 May 23 06:40 pg_wal.tar.gzdrwx------ 2 postgres postgres 18 Apr 17 22:35 pg_xact-rw------- 1 postgres postgres 219 May 13 02:54 postgresql.auto.conf-rw------- 1 postgres postgres 665 Apr 28 02:31 postgresql.conf-rw------- 1 postgres postgres 21 May 23 06:25 tablespace_map
6、解压pg_wal.tar.gz到pg_wal目录中
[postgres@c7slave data]$ tar -zxf pg_wal.tar.gz -C pg_wal/[postgres@c7slave data]$ lltotal 4036-rw------- 1 postgres postgres 272 May 23 06:40 24578.tar.gz-rw------- 1 postgres postgres 226 May 23 06:25 backup_labeldrwx------ 6 postgres postgres 54 Apr 17 22:42 base-rw------- 1 postgres postgres 4061462 May 23 06:40 base.tar.gz-rw------- 1 postgres postgres 44 May 23 03:30 current_logfilesdrwx------ 2 postgres postgres 4096 May 23 06:41 globaldrwx------ 2 postgres postgres 4096 May 23 03:30 logdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_commit_tsdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_dynshmem-rw------- 1 postgres postgres 4540 May 13 02:14 pg_hba.conf-rw------- 1 postgres postgres 1636 Apr 17 22:35 pg_ident.confdrwx------ 4 postgres postgres 68 May 23 06:25 pg_logicaldrwx------ 4 postgres postgres 36 Apr 17 22:35 pg_multixactdrwx------ 2 postgres postgres 6 May 14 04:36 pg_notifydrwx------ 2 postgres postgres 6 May 23 06:25 pg_replslotdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_serialdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_snapshotsdrwx------ 2 postgres postgres 6 May 13 02:14 pg_statdrwx------ 2 postgres postgres 6 May 23 06:24 pg_stat_tmpdrwx------ 2 postgres postgres 6 May 21 02:00 pg_subtransdrwx------ 2 postgres postgres 6 May 14 04:36 pg_tblspcdrwx------ 2 postgres postgres 6 Apr 17 22:35 pg_twophase-rw------- 1 postgres postgres 3 Apr 17 22:35 PG_VERSIONdrwx------ 3 postgres postgres 60 May 23 06:43 pg_wal-rw------- 1 postgres postgres 17070 May 23 06:40 pg_wal.tar.gzdrwx------ 2 postgres postgres 18 Apr 17 22:35 pg_xact-rw------- 1 postgres postgres 219 May 13 02:54 postgresql.auto.conf-rw------- 1 postgres postgres 665 Apr 28 02:31 postgresql.conf-rw------- 1 postgres postgres 21 May 23 06:25 tablespace_map[postgres@c7slave data]$ ll pg_wal/*-rw------- 1 postgres postgres 16777216 May 23 06:25 pg_wal/000000010000000000000029pg_wal/archive_status:total 0
7、查看和创建新自定义表空间目录
[postgres@c7slave backup]$ cat $PGDATA/tablespace_map24578 /data/newspace[postgres@c7slave data]$ mkdir /data/newspace[root@c7slave data]# lltotal 0drwxr-xr-x 3 postgres postgres 24 May 23 06:25 backupdrwxr-xr-x 3 mysql mysql 23 Feb 2 04:45 mysqldrwx------ 3 postgres postgres 29 May 14 04:34 newspace.bak20200523drwxr-xr-x 4 postgres postgres 42 May 23 06:33 pg11
8、将备份中的自定义表空间文件解压到新目录中
[postgres@c7slave backup]$ cd $PGDATA[postgres@c7slave data]$ tar -zxf 24578.tar.gz -C /data/newspace/[postgres@c7slave data]$ cd /data/newspace[postgres@c7slave newspace]$ lltotal 0drwx------ 3 postgres postgres 19 Apr 21 21:51 PG_11_201809051
9、设置新data和自定义表空间目录权限
[postgres@c7slave pg11]$ chmod 700 data[postgres@c7slave pg11]$ chmod 700 /data/newspace
10、启动数据库,恢复结束
[postgres@c7slave pg11]$ pg_ctl startwaiting for server to start....2020-05-23 10:53:56.772 GMT - - - - 38224: LOG: listening on IPv4 address "0.0.0.0", port 65432020-05-23 10:53:56.772 GMT - - - - 38224: LOG: listening on IPv6 address "::", port 65432020-05-23 10:53:56.773 GMT - - - - 38224: LOG: listening on Unix socket "/tmp/.s.PGSQL.6543"2020-05-23 10:53:56.817 GMT - - - - 38224: LOG: redirecting log output to logging collector process2020-05-23 10:53:56.817 GMT - - - - 38224: HINT: Future log output will appear in directory "log".doneserver started
六、pg_basebackup源码简单流程图

参考:
PostgreSQL中文文档:
http://postgres.cn/docs/11/app-pgbasebackup.html
阿里数据库内核月报
http://mysql.taobao.org/monthly/2018/08/06/




