PostgrelSql 9.4 hot standby配置

本文详细介绍了如何配置PostgreSQL 9.4的热备(hot standby),包括创建复制用户、新建数据库、修改主库和备库的配置文件,以及启动备库并监控复制状态。通过这些步骤,可以实现数据库的高可用性和数据同步。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

----配置同步流复制

****************************************************
1.在主库增加同步的用户名与密码
****************************************************

$ psql -h 192.168.50.110  -d postgres -U postgres 
Password for user postgres: 
psql (9.4.4)
Type "help" for help.

postgres=# \l
                                 List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   
-----------+----------+----------+------------+------------+-----------------------
 postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
(3 rows)

postgres=# \c postgres
You are now connected to database "postgres" as user "postgres".

 
postgres=# SELECT rolname from pg_roles ;
 rolname  
----------
 postgres
 repluser
(2 rows)

postgres=# SELECT usename from pg_user; 
 usename  
----------
 postgres
 repluser
(2 rows)


postgres=# CREATE ROLE repluser REPLICATION LOGIN PASSWORD '123';
CREATE ROLE

postgres=#

****************************************************
2.新建测试数据库
****************************************************

postgres=# \l
                                 List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值