当前位置: 移动技术网 > 网络运营>服务器>Linux > 在CentOS中部署多节点Citus集群的详细步骤

在CentOS中部署多节点Citus集群的详细步骤

2019年04月20日  | 移动技术网网络运营  | 我要评论

前言

本文主要介绍了关于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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网