【PostgreSQL】數(shù)據(jù)庫復(fù)制

異步流復(fù)制
[root@wallet01?~]#?su?-?postgres
[postgres@wallet01?~]$?vi?/var/lib/pgsql/9.6/data/pg_hba.conf
host????replication?????postgres????????192.168.1.0/24??????????md5

[postgres@wallet01?~]$?vi?/var/lib/pgsql/9.6/data/postgresql.conf
listen_addresses?=?'0.0.0.0'
max_wal_senders?=?5
wal_level?=?hot_standby?

[postgres@wallet01?~]$?pg_ctl?restart
waiting?for?server?to?shut?down....?done
server?stopped
server?starting

[root@wallet02?~]#?su?-?postgres
[postgres@wallet02?~]$?pg_basebackup?-h?192.168.1.201?-U?postgres?-F?p?-P?-x?-R?-D?/var/lib/pgsql/9.6/data?
Password:?
2161085/2161085?kB?(100%),?1/1?tablespace

[postgres@wallet02?~]$?vi?/var/lib/pgsql/9.6/data/postgresql.conf
hot_standby?=?on

[postgres@wallet02?~]$?vi?/var/lib/pgsql/9.6/data/recovery.conf
standby_mode?=?'on'
primary_conninfo?=?'user=postgres?password=postgres?host=192.168.1.201?port=5432?sslmode=disable?
sslcompression=1?krbsrvname=postgres'

[postgres@wallet02?~]$?pg_ctl?start
server?starting

[postgres@wallet01?~]$?psql
psql?(9.6.12)
Type?"help"?for?help.

postgres=#?select?pid,state,client_addr,sync_priority,sync_state?from?pg_stat_replication;
?pid??|???state???|??client_addr??|?sync_priority?|?sync_state?
------+-----------+---------------+---------------+------------
?2055?|?streaming?|?192.168.1.202?|?????????????0?|?async
(1?row)

網(wǎng)站建設(shè)公司,為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計及定制網(wǎng)站建設(shè)服務(wù),專注于成都定制網(wǎng)站,高端網(wǎng)頁制作,對成都混凝土攪拌罐車等多個行業(yè)擁有豐富的網(wǎng)站建設(shè)經(jīng)驗的網(wǎng)站建設(shè)公司。專業(yè)網(wǎng)站設(shè)計,網(wǎng)站優(yōu)化推廣哪家好,專業(yè)seo優(yōu)化優(yōu)化,H5建站,響應(yīng)式網(wǎng)站。

同步流復(fù)制
[root@wallet01?~]#?su?-?postgres
[postgres@wallet01?~]$?vi?/var/lib/pgsql/9.6/data/pg_hba.conf
host????replication?????postgres????????192.168.1.0/24??????????md5

[postgres@wallet01?~]$?vi?/var/lib/pgsql/9.6/data/postgresql.conf
max_wal_senders?=?5?
wal_level?=?hot_standby
synchronous_standby_names?=?'wallet02,wallet03'

[root@wallet01?~]#?su?-?postgres
[postgres@wallet01?~]$?pg_ctl?reload
server?signaled

[root@wallet02?~]#?su?-?postgres
[postgres@wallet02?~]$?pg_basebackup?-h?192.168.1.201?-U?postgres?-F?p?-P?-x?-R?-D?/var/lib/pgsql/9.6/data?
Password:?
2161085/2161085?kB?(100%),?1/1?tablespace

[postgres@wallet02?~]$?vi?/var/lib/pgsql/9.6/data/postgresql.conf
hot_standby?=?on

[postgres@wallet02?~]$?vi?/var/lib/pgsql/9.6/data/recovery.conf
standby_mode?=?'on'
primary_conninfo?=?'application_name=wallet02?user=postgres?password=postgres?host=192.168.1.201?port=5432?sslmode=disable?sslcompression=1'

[postgres@wallet02?~]$??pg_ctl?start
server?starting

[root@wallet03?~]#?su?-?postgres
[postgres@wallet03?~]$?pg_basebackup?-h?192.168.1.201?-U?postgres?-F?p?-P?-x?-R?-D?/var/lib/pgsql/9.6/data?
Password:?
2161215/2161215?kB?(100%),?1/1?tablespace

[postgres@wallet03?~]$?vi?/var/lib/pgsql/9.6/data/postgresql.conf
hot_standby?=?on

[postgres@wallet03?~]$?vi?/var/lib/pgsql/9.6/data/recovery.conf
standby_mode?=?'on'
primary_conninfo?=?'application_name=wallet03?user=postgres?password=postgres?host=192.168.1.201?port=5432?sslmode=disable?sslcompression=1'

[postgres@wallet03?~]$??pg_ctl?start
server?starting

[postgres@wallet01?~]$?psql
psql?(9.6.12)
Type?"help"?for?help.
postgres=#?select?pid,state,client_addr,sync_priority,sync_state?from?pg_stat_replication;
?pid??|???state???|??client_addr??|?sync_priority?|?sync_state?
------+-----------+---------------+---------------+------------
?1968?|?streaming?|?192.168.1.202?|?????????????1?|?sync
?2018?|?streaming?|?192.168.1.203?|?????????????2?|?potential

分享文章:【PostgreSQL】數(shù)據(jù)庫復(fù)制
文章出自:http://bm7419.com/article12/gejjdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、網(wǎng)站營銷商城網(wǎng)站、電子商務(wù)、建站公司企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都app開發(fā)公司