PostgresSQl是个不错的关系型数据库,得益于UDF分析数据时也很方便,因此很多BI应用也选做为底层存储 。阿里腾讯也在此基础上研发出来面向大数据服务的产品Hologres、Tbase
PostgresXL是PostgresSQL的开源分布式数据库的实现,包括分布式存储、分布式计算 官方网站
本文将介绍如何安装PostgresXL集群。
软件版本
postgres-xl-9.5r1.6
centos7.6
节点规划
节点 | 角色 |
---|---|
bi-test1 | gtmServer |
bi-test3 | gtmProxy、coord、datanode |
bi-test4 | gtmProxy、coord、datanode |
bi-test5 | gtmProxy、coord、datanode |
-
集群host文件
将每个节点主机名对应的IP地址加入集群主机Hosts中 - 创建pgxl用户,配置免密登录
在每个节点创建pgxl用户adduser pgxl && su pgxl
配置免密登录,
RSA公钥
为bi-test1节点的ssh公钥mkdir ~/.ssh && echo 'RSA公钥' >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_key
- 创建编译目录
cd ~ && mkdir pgxl_build_dir && cd pgxl_build_dir
- 配置安装参数
–with-pgport 指定pg端口/home/pgxl/postgres-xl-9.5r1.6/configure --prefix=/home/pgxl/pgxl --with-pgport=15432
- 编译源码
make
- 安装 (注意两种方式)
bi-test1
make install-world
其余节点
make install
- 环境变量配置
vi ~/.bashrc
加入PATH=$PATH:/home/pgxl/pgxl/bin export $PATH
source ~/.bashrc
- 集群初始化
进入bi-test1
运行/home/pgxl/pgxl/bin/pgxc_ctl
进入控制台
输入prepare
生成pgxc_ctl.conf
配置文件
手动编辑pgxc_ctl.conf配置文件
注意每个节点的配置信息,端口,slave,hba entry,链接配置信息
确认配置无误后运行/home/pgxl/pgxl/bin/pgxc_ctl init all
启动集群
pgxl表存储方式有复制表、分片表目前使用下来分片表有些莫名的bug感觉不太稳定