ITPub博客

首页 > 应用开发 > IT综合 > PG9.3.5 流复制测试

PG9.3.5 流复制测试

原创 IT综合 作者:victor1010 时间:2014-11-21 16:57:59 0 删除 编辑




环境信息:主节点 192.168.100.117
          从节点 192.168.100.118


PGDATA=/usr/local/pgsql/data


arch : 
[postgres@TestLinux01 arch]$ ls -lt
total 213004
-rw------- 1 postgres postgres 16777216 Nov 21 16:02 00000001000000000000000D
-rw------- 1 postgres postgres      298 Nov 21 15:34 00000001000000000000000C.00000028.backup
-rw------- 1 postgres postgres 16777216 Nov 21 15:34 00000001000000000000000C
-rw------- 1 postgres postgres 16777216 Nov 21 15:23 00000001000000000000000B
-rw------- 1 postgres postgres 16777216 Nov 21 15:20 00000001000000000000000A
-rw------- 1 postgres postgres 16777216 Nov 21 15:20 000000010000000000000009
-rw------- 1 postgres postgres      297 Nov 21 10:39 000000010000000000000009.00000028.backup
-rw------- 1 postgres postgres 16777216 Nov 21 10:30 000000010000000000000008
-rw------- 1 postgres postgres 16777216 Nov 20 14:08 000000010000000000000007
-rw------- 1 postgres postgres 16777216 Nov 20 13:54 000000010000000000000006
-rw------- 1 postgres postgres 16777216 Nov 20 13:24 000000010000000000000005
-rw------- 1 postgres postgres 16777216 Nov 20 13:22 000000010000000000000004
-rw------- 1 postgres postgres 16777216 Nov 20 13:22 000000010000000000000003
-rw------- 1 postgres postgres 16777216 Nov 20 13:22 000000010000000000000002
-rw------- 1 postgres postgres 16777216 Nov 20 13:22 000000010000000000000001
drwx------ 2 postgres postgres     4096 Nov 20 13:13 20141120


从节点:
[postgres@TestLinux02 data]$ pwd
/usr/local/pgsql/data
[postgres@TestLinux02 data]$ ls
backup_label.old  pg_clog        pg_log        pg_serial     pg_stat_tmp  pg_twophase  postgresql.conf  recovery.conf
base              pg_hba.conf    pg_multixact  pg_snapshots  pg_subtrans  PG_VERSION   postmaster.opts
global            pg_ident.conf  pg_notify     pg_stat       pg_tblspc    pg_xlog      postmaster.pid
[postgres@TestLinux02 data]$ ls -lt  recovery.conf
-rw-r--r-- 1 postgres root 4947 Nov 21 16:21 recovery.conf




standby_mode = 'on'
 trigger_file = '/usr/local/pgsql/data/postgresql.trigger.1949'
 primary_conninfo = 'host=192.168.100.117 port=2017 user=repuser password=repuser keepalives_idle=60'
restore_command = 'cp /usr/local/pgsql/arch/%f "%p"'






主节点:
[postgres@TestLinux01 arch]$ psql -h 192.168.100.117 -p 2017 -U postgres
Password for user postgres: 
psql (8.4.11, server 9.3.5)
WARNING: psql version 8.4, server version 9.3.
         Some psql features might not work.
Type "help" for help.




postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |  Collation  |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 db117     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
(4 rows)


postgres=# \c db117
psql (8.4.11, server 9.3.5)
WARNING: psql version 8.4, server version 9.3.
         Some psql features might not work.
You are now connected to database "db117".
db117=# \dt
                List of relations
 Schema |         Name         | Type  |  Owner   
--------+----------------------+-------+----------
 public | measurement          | table | postgres
 public | measurement_yy04mm02 | table | postgres
 public | measurement_yy05mm11 | table | postgres
 public | measurement_yy05mm12 | table | postgres
 public | measurement_yy06mm01 | table | postgres
 public | pg_log               | table | postgres
 public | t1                   | table | postgres
 public | t2                   | table | postgres
 public | t3                   | table | postgres
 public | t4                   | table | postgres
 public | test                 | table | postgres
(11 rows)


db117=# \dt
                List of relations
 Schema |         Name         | Type  |  Owner   
--------+----------------------+-------+----------
 public | measurement          | table | postgres
 public | measurement_yy04mm02 | table | postgres
 public | measurement_yy05mm11 | table | postgres
 public | measurement_yy05mm12 | table | postgres
 public | measurement_yy06mm01 | table | postgres
 public | pg_log               | table | postgres
 public | t1                   | table | postgres
 public | t2                   | table | postgres
 public | t3                   | table | postgres
 public | t4                   | table | postgres
 public | test                 | table | postgres
(11 rows)


db117=# create table test2 (id int,dex text);
CREATE TABLE
db117=# insert into test2 values(1,'cccccccccccc');
INSERT 0 1
db117=# 




从节点:
[postgres@TestLinux02 ~]$ psql -h 192.168.100.118  -p 2017 -U postgres db117
Password for user postgres: 
psql (8.4.11, server 9.3.5)
WARNING: psql version 8.4, server version 9.3.
         Some psql features might not work.
Type "help" for help.


db117=# \dt
                List of relations
 Schema |         Name         | Type  |  Owner   
--------+----------------------+-------+----------
 public | measurement          | table | postgres
 public | measurement_yy04mm02 | table | postgres
 public | measurement_yy05mm11 | table | postgres
 public | measurement_yy05mm12 | table | postgres
 public | measurement_yy06mm01 | table | postgres
 public | pg_log               | table | postgres
 public | t1                   | table | postgres
 public | t2                   | table | postgres
 public | t3                   | table | postgres
 public | t4                   | table | postgres
 public | test                 | table | postgres
(11 rows)


db117=# create table tt(id int);
ERROR:  cannot execute CREATE TABLE in a read-only transaction
db117=# \dt
                List of relations
 Schema |         Name         | Type  |  Owner   
--------+----------------------+-------+----------
 public | measurement          | table | postgres
 public | measurement_yy04mm02 | table | postgres
 public | measurement_yy05mm11 | table | postgres
 public | measurement_yy05mm12 | table | postgres
 public | measurement_yy06mm01 | table | postgres
 public | pg_log               | table | postgres
 public | t1                   | table | postgres
 public | t2                   | table | postgres
 public | t3                   | table | postgres
 public | t4                   | table | postgres
 public | test                 | table | postgres
 public | test2                | table | postgres
(12 rows)


db117=# \dt test2
         List of relations
 Schema | Name  | Type  |  Owner   
--------+-------+-------+----------
 public | test2 | table | postgres
(1 row)


db117=# select count(*) from test2;
 count 
-------
     0
(1 row)


db117=# select count(*) from test2;
 count 
-------
     1
(1 row)


db117=# select * from test2;
 id |     dex      
----+--------------
  1 | cccccccccccc
(1 row)


db117=# 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8102208/viewspace-1341821/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-29

  • 博文量
    296
  • 访问量
    566857