pg12新特性-max_wal_senders从max_connections分离

瀚高数据
目录
文档用途
详细信息
相关文档

pg12 新特性,max_wal_senders 从 max_connections 分离

详细信息

  1. 官方文档说明

[官方文档](https://www.postgresql.org/docs/12/release-12.html)

Make max_wal_senders not count as part of max_connections (Alexander Kukushkin)
  1. 参数说明

max_connections - 数据库实例允许的最大并发连接数mysql数据命令大全
max_wapostgresql数据查看用户注释l_senders - 通过 pg_basebackup 备份或流复制备库和主库同步占用主库的最大并发连接数
spostgresql安装教程uperuser_reserved_connections - 给超级用户预留连接数

max_wal_senders 和 superuser_reserved_connections 需要的连接数都从 max_connections 中来。受 max_connections 限制。当连接数占满时,使用 max_wal_senders 连接的流复制、逻辑复制、数据库备份 (pg_basebackup)postgresql安装教程 都会收到影响。
从 pg1连接数组元素的方法2 开始,max_wal_senders 从 max_connections 分离出来,不再受 max_connecti连接数据库方法ons 限制,可单独控制,因此很好解决了上面的问题。

  1. 示例
  2. pg11

设置 postgresql.conf 参数数据库设计,如下:

max_connections = 3
superuser_reserved_connections = 0
max_wal_senders = 2

连接两个会话,占用两个连接。

之后在数据库主机上执行 pg_basebackup 命令备份数据库,如下:

$ pg_basebackup -D backup -Ft -P
pg_basebackup: could not connect to server: FATAL: sorry, too many clients already

pg_basebackup 命令消耗的是 max_wpostgresql是什么al_senders 设置的连接数,max_wal_senders 连接数是 max_connections 的子集,由于 pg_basebackup 备份数据库需占用两个连接,因此以上报连接数不足。

  1. Pg12

设置 postgresql.conf 参数,如下:

max_connections = 3
superuser_reserved_connections = 0
max_wal_senders = 2

连接两个会话,占用两个连接。

之后在数据库主机上执行 pg_basebackup 命令备份数据库,如下:

$ pg_basebackup -D backup -Ft -P
3963845/3963845 kB (100%), 1/1 tablespace

备份正常,验证了 12 版本 max_wal_senders 参数不受 max_connections 参数影响。