PostgreSQL Hot Standby功能简析(3)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-25 11:37 点击:次
/var/lib/pgsql/data
linux-david:/var/lib/pgsql/data # service postgresql start
server starting
linux-david:/var/lib/pgsql/data # LOG: database system was interrupted; last known up at 2010-08-21 22:43:04 CST
LOG: entering standby mode
LOG: redo starts at 0/1000020
LOG: record with zero length at 0/10000B0
LOG: streaming replication successfully connected to primary
LOG: consistent recovery state reached at 0/2000000
LOG: database system is ready to accept read only connections
这时可以看到备库已经可以接受只读连接了。
在主库上做一些操作:
linux-david:/var/lib/pgsql/data # psql -p 5432 -d postgres
psql (9.0beta4) www.2cto.com
Type "help" for help.
postgres=# create table t (id int primary key,name varchar(20));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t_pkey" for table "t"
CREATE TABLE
postgres=# insert into t values (1,'xxxxxxx');
INSERT 0 1
postgres=# insert into t values (2,'xxxxxxx');
INSERT 0 1
postgres=#
然后在备库上看是否同步到了备库:
linux-david:/var/lib/pgsql/data # psql -p 5432 -d postgres
psql (9.0beta4)
Type "help" for help.
postgres=# \d
List of relations
Schema | Name | Type | Owner
--------+------+-------+-------
public | t | table | osdba
(1 row)
postgres=# select * from t;
id | name www.2cto.com
----+---------
1 | xxxxxxx
2 | xxxxxxx
(2 rows)
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>