時(shí)間:2024-02-24 17:17作者:下載吧人氣:36
PostgreSQL 9.2.4
主機(jī):192.25.10.76
從機(jī):192.25.10.71
做postgresql的流復(fù)制主從時(shí),會(huì)遇到調(diào)整max_wal_sengers這個(gè)參數(shù),官方文檔對(duì)這個(gè)參數(shù)做了一個(gè)簡(jiǎn)要的說明(9.2.4比早先版本多了幾句話并做了一些微調(diào)),但沒有實(shí)際的例子。
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.
也就是說,這個(gè)參數(shù)是在主機(jī)上設(shè)置的,是從機(jī)連接到主機(jī)的并發(fā)連接數(shù)之總和,所以這個(gè)參數(shù)是個(gè)正整型。默認(rèn)值是0,也即默認(rèn)沒有流復(fù)制功能。該并發(fā)連接數(shù)從進(jìn)程上看,就是各個(gè)wal sender進(jìn)程數(shù)之和,可以通過ps -ef|grep senders來查看,所以該值不能超過系統(tǒng)的最大連接數(shù)(max_connections,該BUG在9.1.5被修復(fù)),可以允許超過實(shí)際的流復(fù)制用戶數(shù)。該參數(shù)更改需要重啟DB,比如我只配了一個(gè)從機(jī):
[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
網(wǎng)友評(píng)論