国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

PostgreSQL學習第十六篇 異步流復制Hot Standby的示例

2019-11-08 20:46:04
字體:
來源:轉載
供稿:網友
配置環境:主機名ip地址角色數據目錄pg186.168.100.14主庫/PostgreSQL/9.6.1/datanpghs186.168.100.24standby/PostgreSQL/9.6.1/datahs主數據庫的配置:允許主庫接受流復制的連接pg_hba.conf中:host    replication     postgres       186.168.100.0/24                  trustpostgresql.conf設置:listen_addresses = '*'max_wal_senders = 5wal_level = hot_standby重啟數據庫standby上的操作:在備庫生成基礎備份:[postgres@pghs data]$ pg_basebackup -h 186.168.100.14 -U postgres -F p -P -x -R -D /PostgreSQL/9.6.1/datahs -l  postgresbackup2017020945089/45089 kB (100%), 2/2 tablespaces那么在/PostgreSQL/9.6.1/datahs 路徑下就看到了拷貝過來的文件等,因為使用了-R,所以有recovery.conf文件,內容:、standby_mode = 'on'PRimary_conninfo = 'user=postgres host=186.168.100.14 port=5432 sslmode=disable sslcompression=1'在啟動standby數據庫之前,需要修改postgresql.conf文件:hot_standby = on啟動standby:[postgres@pghs datahs]$ pg_ctl start -D /PostgreSQL/9.6.1/datahs/server starting[postgres@pghs datahs]$ FATAL:  data directory "/PostgreSQL/9.6.1/datahs" has group or world accessDETAIL:  Permissions should be u=rwx (0700).[postgres@pghs 9.6.1]$ chmod 700 datahs/[postgres@pghs 9.6.1]$ LOG:  redirecting log output to logging collector processHINT:  Future log output will appear in directory "pg_log".在主庫建一個表,然后插入幾條數據:postgres=# create table testhsb(id int,name varchar(10));CREATE TABLEpostgres=# insert into testhsb values (1,'test');INSERT 0 1備庫查詢:postgres=# select * from testhsb; id | name----+------  1 | test(1 row)操作馬上就同步了在備庫嘗試修改:postgres=# delete from testhsb where id=1;ERROR:  cannot execute DELETE in a read-only transaction
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 磴口县| 偏关县| 高邮市| 田阳县| 保康县| 西华县| 双鸭山市| 永仁县| 班玛县| 维西| 苏尼特左旗| 扶沟县| 新昌县| 竹溪县| 兴山县| 奇台县| 金阳县| 罗平县| 武城县| 漯河市| 南皮县| 吴旗县| 佛学| 内江市| 七台河市| 武胜县| 绵阳市| 加查县| 永康市| 河间市| 鸡西市| 土默特右旗| 玉门市| 扶余县| 孙吴县| 康马县| 南开区| 班玛县| 乌鲁木齐市| 澳门| 炎陵县|