前言
本文主要介紹了關于CentOS中部署多節點Citus集群的相關內容,分享出來供大家參考學習,下面話不多說了,來一起看看詳細的介紹吧。
1、在所有節點執行以下步驟
Step 01 添加Citus Repostory
1
2
|
# Add Citus repository for package manager curl https: //install .citusdata.com /community/rpm .sh | sudo bash |
Step 02 安裝Citus并且初始化DB
1
2
3
4
5
6
|
# 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
1
|
sudo vi /var/lib/pgsql/10/data/postgresql .conf |
1
2
|
# Uncomment listen_addresses for the changes to take effect listen_addresses = '*' |
Step 04 配置pg_hba.conf
1
|
sudo vi /var/lib/pgsql/10/data/pg_hba .conf |
1
2
3
4
|
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 配置防火墻
查看
1
|
firewall-cmd --zone=public --query-port=5432 /tcp |
添加5432端口(--permanent永久生效,沒有此參數重啟后失效)
1
|
firewall-cmd --zone=public --add-port=5432 /tcp --permanent |
重新載入
1
|
firewall-cmd --reload |
Step 06 啟動服務
1
2
3
4
|
# 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擴展
1
|
sudo -i -u postgres psql -c "CREATE EXTENSION citus;" |
Step 08 設置密碼
1
2
3
|
postgres= # \password postgres #給postgres用戶設置密碼 Enter new password: Enter it again: |
2、在coordinator節點額外執行以下步驟
Step 01 添加worker節點信息
添加worker節點的IP地址(或者DNS名稱)和端口號到pg_dist_node表。
1
2
|
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 驗證安裝是否成功
1
|
sudo -i -u postgres psql -c "SELECT * FROM master_get_active_worker_nodes();" |
Step 03 開始使用
1
|
sudo -i -u postgres psql |
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,如果有疑問大家可以留言交流,謝謝大家對服務器之家的支持。
參考資料:
https://docs.citusdata.com/en/v7.2/installation/production_rhel.html
原文鏈接:http://www.cnblogs.com/MeteorSeed/p/8465536.html