老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業提供網站建設、域名注冊、服務器等服務

PostgreSQL流復制參數max_wal_senders的用法說明-創新互聯

本篇文章和大家了解一下PostgreSQL流復制參數max_wal_senders的用法說明。有一定的參考價值,有需要的朋友可以參考一下,希望對大家有所幫助。

金林ssl適用于網站、小程序/APP、API接口等需要進行數據傳輸應用場景,ssl證書未來市場廣闊!成為成都創新互聯的ssl證書銷售渠道,可以享受市場價格4-6折優惠!如果有意向歡迎電話聯系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!

環境:

PostgreSQL 9.2.4

主機:192.25.10.76

從機:192.25.10.71

做postgresql的流復制主從時,會遇到調整max_wal_sengers這個參數,官方文檔對這個參數做了一個簡要的說明(9.2.4比早先版本多了幾句話并做了一些微調),但沒有實際的例子。

1.參數說明:

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

2.異常情況

很多時候配置主從的時候會遺漏這個參數,或者沒有設置正確(比如實際配的從機數超過設置的連接數),這個時候一般會報錯 number of requested standby connections exceeds max_wal_senders (currently X): 備機上顯示的日志異常:

2013-08-12 20:53:42.132 CST,,,8859,,5208dad6.229b,1,,2013-08-12 20:53:42 CST,,0,FATAL,XX000,"could not connect to the primary server: FATAL: number of requested standby connections exceeds max_wal_senders (currently 0)
",,,,,,,,,""
2013-08-12 20:53:47.137 CST,,,8861,,5208dadb.229d,1,,2013-08-12 20:53:47 CST,,0,FATAL,XX000,"could not connect to the primary server: FATAL: number of requested standby connections exceeds max_wal_senders (currently 0)
",,,,,,,,,""
2013-08-12 20:53:52.142 CST,,,8862,,5208dae0.229e,1,,2013-08-12 20:53:52 CST,,0,FATAL,XX000,"could not connect to the primary server: FATAL: number of requested standby connections exceeds max_wal_senders (currently 0)
",,,,,,,,,""
2013-08-12 20:53:57.148 CST,,,8864,,5208dae5.22a0,1,,2013-08-12 20:53:57 CST,,0,FATAL,XX000,"could not connect to the primary server: FATAL: number of requested standby connections exceeds max_wal_senders (currently 0)
",,,,,,,,,"

主機上顯示的日志異常:

receiver"
2013-08-12 20:43:26.937 CST,,,21064,"",5208d86e.5248,1,"",2013-08-12 20:43:26 CST,,0,LOG,00000,"connection received: host=192.25.10.71 port=46085",,,,,,,,,""
2013-08-12 20:43:26.938 CST,"repuser","",21064,"192.25.10.71:46085",5208d86e.5248,2,"authentication",2013-08-12 20:43:26 CST,2/1195,0,LOG,00000,"replication connection authorized: user=repuser",,,,,,,,,""
2013-08-12 20:43:26.938 CST,"repuser","",21064,"192.25.10.71:46085",5208d86e.5248,3,"startup",2013-08-12 20:43:26 CST,2/0,0,FATAL,53300,"number of requested standby connections exceeds max_wal_senders (currently 0)",,,,,,,,,"walreceiver"
2013-08-12 20:43:26.939 CST,"repuser","",21064,"192.25.10.71:46085",5208d86e.5248,4,"startup",2013-08-12 20:43:26 CST,,0,LOG,00000,"disconnection: session time: 0:00:00.002 user=repuser database= host=192.25.10.71 port=46085",,,,,,,,,"wa
lreceiver"
2013-08-12 20:43:41.513 CST,,,21066,"",5208d87d.524a,1,"",2013-08-12 20:43:41 CST,,0,LOG,00000,"connection received: host=192.25.10.71 port=46086",,,,,,,,,""
2013-08-12 20:43:41.514 CST,"repuser","",21066,"192.25.10.71:46086",5208d87d.524a,2,"authentication",2013-08-12 20:43:41 CST,2/1198,0,LOG,00000,"replication connection authorized: user=repuser",,,,,,,,,""
2013-08-12 20:43:41.514 CST,"repuser","",21066,"192.25.10.71:46086",5208d87d.524a,3,"startup",2013-08-12 20:43:41 CST,2/0,0,FATAL,53300,"number of requested standby connections exceeds max_wal_senders (currently 0)",,,,,,,,,"walreceiver"
2013-08-12 20:43:41.515 CST,"repuser","",21066,"192.25.10.71:46086",5208d87d.524a,4,"startup",2013-08-12 20:43:41 CST,,0,LOG,00000,"disconnection: session time: 0:00:00.002 user=repuser database= host=192.25.10.71 port=46086",,,,,,,,,"wa
lreceiver"
...

遇到如此問題,則需要檢查postgresql.conf文件的max _wal_senders參數了。

3.參數生效

文檔上說明需要重啟DB使之生效,如果動態使之生效會報錯如下:

[postgres@proxy1 ]$ psql
psql (9.2.4)
Type "help" for help.
postgres=# show max_wal_senders ;
 max_wal_senders 
-----------------
 0
(1 row)
postgres=# set max_wal_senders=1;
ERROR: parameter "max_wal_senders" cannot be changed without restarting the server
postgres=#

補充: postgresql基于流復制 (streaming replication)的warm-standby

實例一枚:

Primary:

l 歸檔設置:

Wal_level=archive
Archive_mode=on
archive_command = 'cp -i %p /data/pgsql/archived_wal/%f'

l 流復制相關設置:

max_wal_senders = '10'  #啟動復制進程數量限制,必須大于0
max_replication_slots = '10' #為使用replication slot,必須大于0;replication slot作用是保證wal沒有同步到standby之前不能從pg_xlog移走;
wal_keep_segments = '50'    #指定pg_xlog中最少保留的wal數量
 
select pg_create_physical_replication_slot(‘gp1_a_slot'); #創建replication slot
select * from pg_replication_slots;       #查詢創建的replication slot

l 編輯pg_hba.conf

# Allow replication connections from localhost, by a user with the replication privilege.
#host replication  postgres  127.0.0.1/32   trust
#host replication  postgres  ::1/128     trust
local replication  postgres        trust
host replication  postgres  192.168.12.0/24   trust

l 聯機備份過程(基礎備份)

#touch /var/lib/pgsql/backup_in_progress
$psql –c "select pg_start_backup('hot_backup');"
$tar -cf /var/lib/pgsql/backup.tar /var/lib/pgsql/data/
$psql -c "select pg_stop_backup();"
#rm /var/lib/pgsql/backup_in_progress
tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/ #打包歸檔

實例:

psql -c "select pg_start_backup('pgbk10');"
tar -zcf pgbk10.tgz data/
psql -c "select pg_stop_backup();"

Standby:

l 編輯recovery.conf

standby_mode = 'on'
primary_conninfo = 'host=192.168.12.38 port=5666 user=postgres'
primary_slot_name='gp1_a_slot'
#restore_command = 'cp /data/pgsql/archived_wal/%f %p'
#archive_cleanup_command = 'pg_archivecleanup /data/pgsql/archived_wal %r'

l 將primary上的基礎備份傳輸到standby上

$scp primary: /var/lib/pgsql/backup.tar .

解壓備份到standby上的$PGDATA

l 啟動standby

$pg_ctl start –D $PGDATA

啟動standby后,postgres開始從primary上接收wal日志進行恢復,并且一直保持恢復狀態,psql不能登錄;

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持創新互聯網站建設公司,。如有錯誤或未考慮完全的地方,望不吝賜教。

以上就是PostgreSQL流復制參數max_wal_senders的用法說明的簡略介紹,當然詳細使用上面的不同還得要大家自己使用過才領會。如果想了解更多,歡迎關注創新互聯行業資訊頻道哦!


網頁標題:PostgreSQL流復制參數max_wal_senders的用法說明-創新互聯
網站地址:http://www.xueling.net.cn/article/cchsps.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP
主站蜘蛛池模板: 成人一级黄色毛片 | 91精品国产综合久久久动漫日韩 | 中文字幕日韩一区二区三区 | 久久精品国产免费观看三人同眠 | 国产在线观看高清 | 亚洲a资源| 国产麻豆高潮流白浆喷水免费网站 | 精品国产第一区二区三区的区别 | 东京热加勒比无码少妇 | 韩国19禁无遮挡啪啪无码网站 | 脱了美女内裤猛烈进入gif | 国产成人亚洲精品无码青 | 四虎综合网 | 性淫视频| 亚洲欧美色视频 | 国产高清自拍视频 | 无码精品一区二区三区在线 | 国产精品国产三级国产普通话三级 | 欧美疯狂性受XXXXX另类 | 日韩操穴| 精品成人免费自拍视频 | 国产成人久久精品二区三区牛 | 久久久999成人 | 国产一级做a爱片在线看免费 | 波多野结衣高清一区二区三区 | 久草热在线 | 婷婷伊人久久大香线蕉av | 国产色欲AV一区二区三区 | 亚洲精品hd| 国产无遮挡乱子伦免费精品 | 国产一级桃视频播放 | 尤物网精品视频 | 一区视频免费在线观看 | 欧美精品一区二区三区中文欧美人 | 这里只有精品在线 | 狠狠躁夜夜躁av蜜臀少妇 | 国产精品国产三级国AV麻豆 | 免费午夜小视频 | 一级黄色美女片 | 野花社区www官网在线观看 | 九九热1 |