云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > Postgres-XL集群安装与配置

Postgres-XL集群安装与配置

  • 62 次阅读
  • 3 次下载
  • 2025/7/5 18:35:36

vi /pgxl_data/datanode/dn1/pg_hba.conf # IPv4 local connections: host all all 127.0.0.1/32 trust host all all 0.0.0.0/0 md5

vi /pgxl_data/datanode/dn2/postgresql.conf #———————————— listen_addresses = ‘*’ port = 15432

max_connections = 100

# DATA NODES AND CONNECTION POOLING #———————————————- pooler_port = 6668 #min_pool_size = 1 max_pool_size = 100 # GTM CONNECTION #—————————– gtm_host = ‘192.168.8.106’ gtm_port = 6666

pgxc_node_name = ‘db2’

vi /pgxl_data/datanode/dn2/pg_hba.conf # IPv4 local connections: host all all 127.0.0.1/32 trust host all all 0.0.0.0/0 md5 7)启动节点 启动顺序

gtm + (gtm_standby) + (gtmproxy) + datanode + coordinator ? 启动gtm

$gtm -D /pgxl_data/gtm & ? 启动datanode

$postgres –datanode -D /pgxl_data/datanode/dn1 & $postgres –datanode -D /pgxl_data/datanode/dn2 &

? 启动coordinator

$postgres –coordinator -D /pgxl_data/coordinator/cd1 & $postgres –coordinator -D /pgxl_data/coordinator/cd2 & 8)注册节点

? 在coord1上注册

$psql –p 1921 postgres Select * from pgxc_node;

create node coord2 with (TYPE=coordinator, HOSt=’192.168.8.106’, PORT=1925); create node db1 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15431, primary); create node db2 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15432); alter node coord1 with (TYPE=’coordinator’, HOST=’192.168.8.106’, PORT=1921); select pgxc_pool_reload(); ? 在coord2上注册

$psql –p 1925 postgres Select * from pgxc_node;

create node coord1 with (TYPE=coordinator, HOST=’192.168.8.106’, PORT=1921); create node db1 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15431, primary); create node db2 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15432); alter node coord2 with (TYPE=’coordinator’ HOST=’192.168.8.106’, PORT=15431, primary=true);

select pgxc_pool_reload(); ? 在db1上注册

$psql –p 15431 postgres Select * from pgxc_node;

create node coord1 with (TYPE=coordinator, HOST=’192.168.8.106’, PORT=1921); create node coord2 with (TYPE=coordinator, HOST=’192.168.8.106’, PORT=1925); create node db2 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15432); alter node db1 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15431, primary=true);

select pgxc_pool_reload(); ? 在db2上注册

$psql –p 15432 postgres

Select * from pgxc_node;

create node coord1 with (TYPE=coordinator, HOST=’192.168.8.106’, PORT=1921); create node coord2 with (TYPE=coordinator, HOST=’192.168.8.106’, PORT=1925); create node db1 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15431,primary); alter node db2 with (TYPE=datanode, HOST=’192.168.8.106’, PORT=15432, primary=false);

select pgxc_pool_reload();

注册节点后,每个节点上都能查询到以下结果:

9)停止节点 停止顺序

coordinator + datanode + (gtmproxy) + (gtm_standby) + gtm

停止节点指令:

$pg_ctl stop –D /pgxl_data/coordinator/cd1 –Z coordinator –m fast $pg_ctl stop –D /pgxl_data/coordinator/cd2 –Z coordinator –m fast $pg_ctl stop –D /pgxl_data/datanode/dn1 –Z datanode –m fast $pg_ctl stop –D /pgxl_data/datanode/dn2 –Z datanode –m fast $gtm_ctl stop –D /pgxl_data/gtm –Z gtm –m fast

3.验证测试

在coord1上创建一个数据库

$psql –p 1921 postgres

postgres=# create database pgxl_test;

postgres=#\\c pgxl_test #切换到pgxl_test数据库

? 创建分区表

create table test_xl (id integer,name varchar(32));

(1)测试插入100条记录

insert into test_xl select generate_series(1,100),’pgxl_test’;

到db1、db2查看pgxl_test中test_xl表中的数据量。 登录db1节点:

登录db2节点:

? 创建复制表

create table t2(id serial8 primary key, info text, crt_time timestamp) DISTRIBUTE BY REPLICATION; (1). 测试插入数据

insert into t2 (info, crt_time) select md5(random()::text), clock_timestamp() from generate_series(1,200);

可以登录db1,db2查看pgxl_test中t2表的数据量都是200:

搜索更多关于: Postgres-XL集群安装与配置 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

vi /pgxl_data/datanode/dn1/pg_hba.conf # IPv4 local connections: host all all 127.0.0.1/32 trust host all all 0.0.0.0/0 md5 vi /pgxl_data/datanode/dn2/postgresql.conf #———————————— listen_addresses = ‘*’ port = 15432 max_connections = 100 # DATA NODES AND CONNECTION POOLING #———————————————- pooler_port = 6668 #min_pool_size = 1 max_pool_size = 100 # GTM CONNECTION #———————

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com