设为首页 加入收藏

TOP

centos6.5下postgres-XC集群安装与配置(四)
2015-11-21 01:41:16 来源: 作者: 【 】 浏览:6
Tags:centos6.5 postgres-XC 集群 安装 配置
据节点配置文件/home/pgxc/pgdata/postgresql.conf的内容如下:

# - Connection Settings -

listen_addresses = '*'

port = 5433

max_connections = 100

# DATA NODES AND CONNECTION POOLING

#----------------------------------------

pooler_port = 6668

#min_pool_size = 1

max_pool_size = 100

?

# GTM CONNECTION

#---------------------------

gtm_host = '172.16.0.101'

gtm_port = 6666

pgxc_node_name = 'dn3'

?

172.16.0.105这台机器上数据节点配置文件/home/pgxc/pgdata/pg_hba.conf的内容如下:

# IPv4 local connections:

host all all 127.0.0.1/32 trust

host all all 172.16.0.0/24 trust

host all all 0.0.0.0/0 md5

?

十一、启动集群

启动集群的顺序为:

GTM

GTM Standby

GTP-Proxy

Datanodes

Coordinators

启动上面示例的集群的方法如下。

在172.16.0.101机器启动gtm,命令如下:

[pgxc@gtm ~]$ gtm_ctl -Z gtm start -D /home/pgxc/gtm

?

在172.16.0.102机器启动gtm standby,命令如下:

[pgxc@standby ~]$ gtm_ctl -Z gtm_standby start -D /home/pgxc/gtm_standby

?

可以用下面的命令查看gtm和gtm standby是否启动:

[pgxc@gtm ~]$ gtm_ctl -Z gtm status -D /home/pgxc/gtm

gtm_ctl: server is running (PID: 2091)

"-D" "/home/pgxc/gtm"

1 master

?

[pgxc@standby ~]$ gtm_ctl -Z gtm_standby status -D /home/pgxc/gtm_standby

gtm_ctl: server is running (PID: 2095)

"-D" "/home/pgxc/gtm_standby"

0 slave

?

以上说明启动成功。

?

启动完gtm和gtm_standby后,就可以启动gtm_proxy了。在172.17.0.103,172.16.0.104,172.16.0.105这三台机器上运行如下命令:

gtm_ctl -Z gtm_proxy start -D /home/pgxc/gtm_proxy

?

启动完gtm_proxy就可以启动Datanodes了。在上述三台机器分别运行如下命令来启动:

pg_ctl start -D /home/pgxc/pgdata -Z datanode

?

最后启动Coordinators。在上述三台机器上运行如下命令启动:

pg_ctl start -D /home/pgxc/coordinator -Z coordinator

?

十二、配置集群节点信息

在各个Coordinator上,执行如下命令:

下面就执行172.16.0.103主机器上的。其它的大家自己操作。

psql -p 5432 postgres

[pgxc@cd1 ~]$ psql -p 5432 postgres

psql (PGXC , based on PG 9.3.2)

Type "help" for help.

?

postgres=# select * from pgxc_node;

node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id

-----------+-----------+-----------+--------------+----------------+------------------+-------------

co1 | C | 5432 | localhost | f | f

| 1344656819

?

postgres=#create node dn1 with(type='datanode',host='172.16.0.103',port=5433,primary,preferred);

?

postgres=#create node dn2 with(type='datanode',host='172.16.0.104',port=5433);

?

postgres=#create node dn3 with(type='datanode',host='172.16.0.105',port=5433);

?

postgres=#create node co2 with(type='coordinator',host='172.16.0.104',port=5432);

?

postgres=#create node co3 with(type='coordinator',host='172.16.0.105',port=5432);

?

?

postgres=# select * from pgxc_node;

node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id

-----------+-----------+-----------+--------------+----------------+------------------+-------------

co1 | C | 5432 | localhost | f | f | 1344656819

dn1 | D | 5433 | 172.16.0.103 | t | t | -560021589

dn2 | D | 5433 | 172.16.0.104 | f | f | 352366662

dn3 | D | 5433 | 172.16.0.105 | f | f | -700122826

co2 | C | 5432 | 172.16.0.104 | f | f | 474101254

co3 | C | 5432 | 172.16.0.105 | f | f | -1046823559

(6 rows)

?

postgres=#select pgxc_pool_reload();

?

十三、测试

[pgxc@cd1 ~]$ psql -p 5432 postgres

psql (PGXC , based on PG 9.3.2)

Type "help" for help.

postgres=# select * from pgxc_node;

node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id

-----------+-----------+-----------+--------------+----------------+------------------+---------

首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇小贝_redislist类型学习 下一篇数据库中为什么需要ImplictCommit..

评论

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