# Add Citus repository for package manager curl https://install.citusdata.com/community/rpm.sh | sudo bash
# 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
sudo vi /var/lib/pgsql/10/data/postgresql.conf
# Uncomment listen_addresses for the changes to take effect listen_addresses = '*'
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
查看html
firewall-cmd --zone=public --query-port=5432/tcp
添加5432端口(--permanent永久生效,沒有此參數重啓後失效)node
firewall-cmd --zone=public --add-port=5432/tcp --permanent
從新載入sql
firewall-cmd --reload
# start the db server sudo service postgresql-10 restart # and make it start automatically when computer does sudo chkconfig postgresql-10 on
sudo -i -u postgres psql -c "CREATE EXTENSION citus;"
postgres=# \password postgres #給postgres用戶設置密碼 Enter new password: Enter it again:
添加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);"
sudo -i -u postgres psql -c "SELECT * FROM master_get_active_worker_nodes();"
sudo -i -u postgres psql
參考資料:bash
https://docs.citusdata.com/en/v7.2/installation/production_rhel.htmlcurl