设为首页 加入收藏

TOP

PostgreSQL-XL安装部署(五)
2015-12-01 16:02:57 来源: 作者: 【 】 浏览:18
Tags:PostgreSQL-XL 安装 部署
? ? ? | f? ? ? ? ? ? ? ? |? 1938253334
?coordinator2 | C? ? ? ? |? ? ? 5432 | 192.168.100.202 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? | -2089598990
?datanode1? ? | D? ? ? ? |? ? 15432 | localhost? ? ? | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? |? 888802358
?datanode2? ? | D? ? ? ? |? ? 15432 | 192.168.100.202 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? |? -905831925
(4 rows)
?
select pgxc_pool_reload();
?pgxc_pool_reload
------------------
?t
(1 row)
?
[pgxl@localhost bin]$


?


node2:


协调节点:


[pgxl@localhost bin]$ ./psql -p 5432 -d postgres
psql (PGXL 9.2.0, based on PG 9.2.4 (Postgres-XL 9.2.0))
Type "help" for help.
?
postgres=# CREATE NODE coordinator1 WITH (TYPE='coordinator',HOST='192.168.100.201',PORT=5432);
CREATE NODE
postgres=# CREATE NODE datanode1 WITH (TYPE='datanode',HOST='192.168.100.201',PORT=15432);
CREATE NODE
postgres=# CREATE NODE datanode2 WITH (TYPE='datanode',HOST='192.168.100.202',PORT=15432);
CREATE NODE
?
postgres=# select * from pgxc_node;
? node_name? | node_type | node_port |? ? node_host? ? | nodeis_primary | nodeis_preferred |? node_id?
--------------+-----------+-----------+-----------------+----------------+------------------+-------------
?coordinator2 | C? ? ? ? |? ? ? 5432 | localhost? ? ? | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? | -2089598990
?coordinator1 | C? ? ? ? |? ? ? 5432 | 192.168.100.201 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? | 1938253334
?datanode1? ? | D? ? ? ? |? ? 15432 | 192.168.100.201 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? |? 888802358
?datanode2? ? | D? ? ? ? |? ? 15432 | 192.168.100.202 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? |? -905831925
?
select pgxc_pool_reload();
?pgxc_pool_reload
------------------
?t
(1 row)
?
[pgxl@localhost bin]$


数据节点:


[pgxl@localhost bin]$ ./psql -p 15432 -d postgres
psql (PGXL 9.2.0, based on PG 9.2.4 (Postgres-XL 9.2.0))
Type "help" for help.
?
postgres=# CREATE NODE coordinator1 WITH (TYPE='coordinator',HOST='192.168.100.201',PORT=5432);
CREATE NODE
postgres=# CREATE NODE coordinator2 WITH (TYPE='coordinator',HOST='192.168.100.202',PORT=5432);
CREATE NODE
postgres=# ALTER NODE datanode2 WITH (TYPE='datanode',HOST='localhost',PORT=15432);
ALTER NODE
postgres=# CREATE NODE datanode1 WITH (TYPE='datanode',HOST='192.168.100.202',PORT=15432);
CREATE NODE
?
postgres=# select * from pgxc_node;
? node_name? | node_type | node_port |? ? node_host? ? | nodeis_primary | nodeis_preferred |? node_id?
--------------+-----------+-----------+-----------------+----------------+------------------+-------------
?coordinator1 | C? ? ? ? |? ? ? 5432 | 192.168.100.201 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? |? 1938253334
?coordinator2 | C? ? ? ? |? ? ? 5432 | 192.168.100.202 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? | -2089598990
?datanode2? ? | D? ? ? ? |? ? 15432 | localhost? ? ? | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? |? -905831925
?datanode1? ? | D? ? ? ? |? ? 15432 | 192.168.100.201 | f? ? ? ? ? ? ? | f? ? ? ? ? ? ? ? |? 888802358
(4 rows)
?
select pgxc_pool_reload();
?pgxc_pool_reload
------------------
?t
(1 row)
?
[pgxl@localhost bin]$


搭建后效果:


?node1:
postgres=# create table test(t1 int, t2 text);
LOG:? Will fall back to local snapshot for XID = 16757, source = 0, gxmin = 0, autovac launch = 0, autovac = 0, normProcMode = 0, postEnv = 1
CREATE TABLE
postgres=# insert into test values (1,'a');
INSERT 0 1
postgres=# insert into test values (2,'b');
INSERT 0 1
postgres=# execute direct on (datanode1) $$ select * from test $$;
?t1 | t2
----+----
? 1 | a
? 2 | b
(2 rows)
?
postgres=# select * from test ;
?t1 | t2
----+----
? 1 | a
? 2 | b
(2 rows)
?
postgres=#
?
node2:
postgres=# select * from test ;
LOG:? Will fall back to local snapshot for XID = 16789, source = 0, gxmin = 0, autovac launch = 0, autov

首页 上一页 2 3 4 5 下一页 尾页 5/5/5
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇PostgreSQL用C完成存储过程实例 下一篇使用Cygwin中的AWK工具进行mysql ..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: