時間:2024-02-24 17:17作者:下載吧人氣:19
PostgreSQL 9.2.4
主機:192.25.10.76
從機:192.25.10.71
做postgresql的流復制主從時,會遇到調整max_wal_sengers這個參數,官方文檔對這個參數做了一個簡要的說明(9.2.4比早先版本多了幾句話并做了一些微調),但沒有實際的例子。
Specifies the maximum number of concurrent connections from standby servers or streaming base backup clients (i.e., the maximum number of simultaneously running WAL sender processes). The default is zero, meaning replication is disabled. WAL sender processes count towards the total number of connections, so the parameter cannot be set higher than max_connections. This parameter can only be set at server start. wal_level must be set to archive or hot_standby to allow connections from standby servers.
也就是說,這個參數是在主機上設置的,是從機連接到主機的并發連接數之總和,所以這個參數是個正整型。默認值是0,也即默認沒有流復制功能。該并發連接數從進程上看,就是各個wal sender進程數之和,可以通過ps -ef|grep senders來查看,所以該值不能超過系統的最大連接數(max_connections,該BUG在9.1.5被修復),可以允許超過實際的流復制用戶數。該參數更改需要重啟DB,比如我只配了一個從機:
[postgres@ndb2 database]$ ps -ef|grep sender
postgres 21257 21247 0 20:57 ? 00:00:00 postgres: wal sender process repuser 192.25.10.71(46161) streaming 0/4018ED8
postgres 22193 20949 0 23:02 pts/0 00:00:00 grep sender
網友評論