在CentOS上部署多节点Citus集群

1 在所有节点执行以下步骤

Step 01 添加Citus Repostory

# Add Citus repository for package manager
curl https://install.citusdata.com/community/rpm.sh | sudo bash

Step 02 安装Citus并且初始化DB

# install PostgreSQL with Citus extension
sudo yum install -y citus72_10
# initialize system database (using RHEL 6 vs 7 method as necessary)
sudo service postgresql-10 initdb || sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
# preload citus extension
echo "shared_preload_libraries = 'citus'" | sudo tee -a /var/lib/pgsql/10/data/postgresql.conf

Step 03 配置postgresql.conf

sudo vi /var/lib/pgsql/10/data/postgresql.conf
# Uncomment listen_addresses for the changes to take effect
listen_addresses = '*'

Step 04 配置pg_hba.conf

sudo vi /var/lib/pgsql/10/data/pg_hba.conf
local   all             all                                          peer      
local replication all peer
host all all
192.168.99.1/24 trust
host all all 0.0.0.0/0 md5

Step 05 配置防火墙

  查看

firewall-cmd --zone=public --query-port=5432/tcp

  添加5432端口(--permanent永久生效,没有此参数重启后失效)

firewall-cmd --zone=public --add-port=5432/tcp --permanent

  重新载入

firewall-cmd --reload

Step 06 启动服务

# start the db server
sudo service postgresql-10 restart
# and make it start automatically when computer does
sudo chkconfig postgresql-10 on

Step 07 给需要的数据库安装Citus扩展

sudo -i -u postgres psql -c "CREATE EXTENSION citus;"

Step 08 设置密码

postgres=# \password postgres          #给postgres用户设置密码
Enter new password: 
Enter it again: 

2 在coordinator节点额外执行以下步骤

Step 01 添加worker节点信息

  添加worker节点的IP地址(或者DNS名称)和端口号到pg_dist_node表。

sudo -i -u postgres psql -c "SELECT * from master_add_node('192.168.99.101', 5432);"
sudo -i -u postgres psql -c "SELECT * from master_add_node('192.168.99.102', 5432);"

Step 02 验证安装是否成功

sudo -i -u postgres psql -c "SELECT * FROM master_get_active_worker_nodes();"

Step 03 开始使用

sudo -i -u postgres psql

 参考资料:

  https://docs.citusdata.com/en/v7.2/installation/production_rhel.html

posted @   MeteorSeed  阅读(1334)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示