欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

PostgreSQL12搭建流復(fù)制的過程是什么-創(chuàng)新互聯(lián)

本篇內(nèi)容主要講解“PostgreSQL 12搭建流復(fù)制的過程是什么”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“PostgreSQL 12搭建流復(fù)制的過程是什么”吧!

成都創(chuàng)新互聯(lián)從2013年開始,先為大東等服務(wù)建站,大東等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為大東企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

主庫
創(chuàng)建復(fù)制用戶

[pg12@localhost pg120db]$ psql -c "CREATE USER replicator WITH REPLICATION ENCRYPTED PASSWORD 'test'" -d testdb
Timing is on.
Expanded display is used automatically.
CREATE ROLE
Time: 30.796 ms

常規(guī)參數(shù)配置

[pg12@localhost pg120db]$ grep 'listen' postgresql.conf 
listen_addresses = '*'        # what IP address(es) to listen on;
pg12@localhost pg120db]$ grep 'replication' pg_hba.conf 
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# keyword does not match "replication". Access to replication
# "all", "sameuser", "samerole" or "replication" makes the name lose
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             192.168.0.0/16          md5
host    replication     all             ::1/128                 trust
[pg12@localhost pg120db]$

重新加載配置參數(shù)

[pg12@localhost pg120db]$ psql -c "select pg_reload_conf()" -d testdb
Timing is on.
Expanded display is used automatically.
 pg_reload_conf 
----------------
 t
(1 row)
Time: 454.580 ms

確認(rèn)該庫為master主庫

[pg12@localhost pg120db]$ psql -c "select pg_is_in_recovery()" -d testdb
Timing is on.
Expanded display is used automatically.
 pg_is_in_recovery 
-------------------
 f
(1 row)
Time: 23.530 ms
[pg12@localhost pg120db]$

備庫
使用pg_basebackup執(zhí)行主庫備份

[pg12@localhost ~]$ pg_basebackup -h 192.168.26.28 -U replicator -p 5432 -D $PGDATA -Fp -Xs -P -R
Password: 
 426401/9113562 kB (4%), 0/1 tablespace

其中-Fp表示以plain格式數(shù)據(jù),-Xs表示以stream方式包含所需的WAL文件,-P表示顯示進(jìn)度,-R表示為replication寫配置信息。
備份完成,使用-R選項(xiàng),在data目錄下自動(dòng)生成standby.signal“信號(hào)”文件(可手工使用touch命令生成)以及更新了postgresql.auto.conf文件,postgresql.auto.conf中寫入了主庫的連接信息(可手工添加primary_conninfo信息)。

[pg12@localhost ~]$ pg_basebackup -h 192.168.26.28 -U replicator -p 5432 -D $PGDATA -Fp -Xs -P -R
Password: 
9113571/9113571 kB (100%), 1/1 tablespace
[pg12@localhost ~]$ 
[pg12@localhost ~]$ cd $PGDATA
[pg12@localhost testdb]$ ls
backup_label      pg_commit_ts   pg_log        pg_replslot   pg_stat_tmp  PG_VERSION            postgresql.conf
base              pg_dynshmem    pg_logical    pg_serial     pg_subtrans  pg_wal                standby.signal
current_logfiles  pg_hba.conf    pg_multixact  pg_snapshots  pg_tblspc    pg_xact
global            pg_ident.conf  pg_notify     pg_stat       pg_twophase  postgresql.auto.conf
[pg12@localhost testdb]$ ll standby.signal 
-rw-------. 1 pg12 pg12 0 Nov 12 16:35 standby.signal
[pg12@localhost testdb]$ 
[pg12@localhost testdb]$ cat postgresql.auto.conf
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
primary_conninfo = 'user=replicator password=test host=192.168.26.28 port=5432 sslmode=prefer sslcompression=0 gssencmode=prefer krbsrvname=postgres target_session_attrs=any'
[pg12@localhost testdb]$ 
[pg12@localhost testdb]$ grep 'primary_conninfo' postgresql.*
postgresql.auto.conf:primary_conninfo = 'user=replicator password=test host=192.168.26.28 port=5432 sslmode=prefer sslcompression=0 gssencmode=prefer krbsrvname=postgres target_session_attrs=any'
postgresql.conf:#primary_conninfo = ''            # connection string to sending server
[pg12@localhost testdb]$

在PG 11中,需要?jiǎng)?chuàng)建recovery.conf文件,在此文件中配置standby_mode和primary_conninfo參數(shù),PG 12已不再需要該文件,改為standby.signal文件以及通過配置參數(shù)直接設(shè)置。

備庫啟動(dòng)數(shù)據(jù)庫,通過pg_is_in_recovery確認(rèn)是否正常配置

[pg12@localhost testdb]$ pg_ctl -D $PGDATA start
waiting for server to start....2019-11-12 16:46:31.635 CST [20436] LOG:  starting PostgreSQL 12.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
2019-11-12 16:46:31.636 CST [20436] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-11-12 16:46:31.636 CST [20436] LOG:  listening on IPv6 address "::", port 5432
2019-11-12 16:46:31.638 CST [20436] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-11-12 16:46:31.750 CST [20436] LOG:  redirecting log output to logging collector process
2019-11-12 16:46:31.750 CST [20436] HINT:  Future log output will appear in directory "pg_log".
 done
server started
[pg12@localhost testdb]$ psql -c "select pg_is_in_recovery()" -d testdb
 pg_is_in_recovery 
-------------------
 t
(1 row)
[pg12@localhost testdb]$

完成搭建
通過pg_stat_replication可查詢復(fù)制狀態(tài)(異步復(fù)制)

[pg12@localhost pg120db]$ psql -x -c "select * from pg_stat_replication" -d testdb
Timing is on.
Expanded display is used automatically.
-[ RECORD 1 ]----+------------------------------
pid              | 4503
usesysid         | 155959
usename          | replicator
application_name | walreceiver
client_addr      | 192.168.26.25
client_hostname  | 
client_port      | 35172
backend_start    | 2019-11-12 16:46:31.000236+08
backend_xmin     | 
state            | streaming
sent_lsn         | 6/A3000148
write_lsn        | 6/A3000148
flush_lsn        | 6/A3000148
replay_lsn       | 6/A3000148
write_lag        | 
flush_lag        | 
replay_lag       | 
sync_priority    | 0
sync_state       | async
reply_time       | 2019-11-12 16:48:32.509887+08
Time: 149.682 ms
[pg12@localhost pg120db]$

到此,相信大家對(duì)“PostgreSQL 12搭建流復(fù)制的過程是什么”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

分享標(biāo)題:PostgreSQL12搭建流復(fù)制的過程是什么-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://chinadenli.net/article38/cdjopp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)搜索引擎優(yōu)化、做網(wǎng)站、網(wǎng)站設(shè)計(jì)公司網(wǎng)站營(yíng)銷、域名注冊(cè)

廣告

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

營(yíng)銷型網(wǎng)站建設(shè)
国产精品成人免费精品自在线观看| 日韩不卡一区二区视频| 可以在线看的欧美黄片| 亚洲一区二区三区免费的视频| 国产精品免费视频久久| 樱井知香黑人一区二区| 亚洲国产黄色精品在线观看| 色狠狠一区二区三区香蕉蜜桃| 中文字幕人妻综合一区二区| 日本午夜免费观看视频| 亚洲国产一区精品一区二区三区色 | 一本色道久久综合狠狠躁| 爽到高潮嗷嗷叫之在现观看| 激情图日韩精品中文字幕| 亚洲综合伊人五月天中文 | 99免费人成看国产片| 爽到高潮嗷嗷叫之在现观看| 精品久久少妇激情视频| 国产日本欧美特黄在线观看| 日韩丝袜诱惑一区二区| 日韩欧美国产亚洲一区| 国产高清一区二区不卡| 国产综合一区二区三区av| 超碰在线免费公开中国黄片| 91福利视频日本免费看看| 日本人妻精品有码字幕| 少妇熟女精品一区二区三区| 日韩一区二区三区免费av| 免费大片黄在线观看日本| 久久综合狠狠综合久久综合| 国产一区二区精品高清免费| 视频一区日韩经典中文字幕| 91人妻人人做人碰人人九色| 女人高潮被爽到呻吟在线观看| 一区二区在线激情视频| 日韩特级黄色大片在线观看| 日韩国产亚洲欧美激情| 日韩中文字幕狠狠人妻| 亚洲乱码av中文一区二区三区| 夜夜嗨激情五月天精品| 免费在线观看激情小视频|