Database-Postgresql-Centos 7安装citus集群
Database-Postgresql-Centos 7安装citus集群
- 第一步:扩展依赖安装:
- 第二步:安装citus源:
- 第三步:配置postgresql源:
- 第四步:安装citus和postgresql10、postgis2.5
- 第五步:initialize a database
- 第六步:Configure connection and authentication:
- 第七步:Start database servers, create Citus and Postgis extension
- 第八步:Add worker node information
- 第九步:Verify that installation has succeeded
- 示例:
安装基于postgresql10的citus集群
三个节点,centos7.4,一个coordinator,两个worker
基础环境(ip、selinux、ssh互信等已完成)
第一步:扩展依赖安装:
yum install -y epel-release && yum update -y
第二步:安装citus源:
curl https://install.citusdata.com/community/rpm.sh | sudo bash
第三步:配置postgresql源:
vi /etc/yum.repos.d/pgdg-11-centos.repo
将11都改为10
第四步:安装citus和postgresql10、postgis2.5
#yum install -y citus74_10 此命令将安装postgresql10
#yum install -y postgis25_10 安装postgis
第五步:initialize a database
#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
第六步:Configure connection and authentication:
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
#Allow unrestricted access to nodes in the local network. The following ranges
#correspond to 24, 20, and 16-bit blocks in Private IPv4 address spaces.
host all all 10.0.0.0/8 trust
#Also allow the host unrestricted access to connect to itself
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
该实验在pg_hba.cong只执行
echo “host all all 0.0.0.0/0 trust” | sudo tee -a /var/lib/pgsql/10/data/pg_hba.conf
第七步:Start database servers, create Citus and Postgis extension
service postgresql-10 restart
chkconfig postgresql-10 on
sudo -i -u postgres psql -c “CREATE EXTENSION citus;”
sudo -i -u postgres psql -c “CREATE EXTENSION postgis;”
sudo -i -u postgres psql -c “alter user postgres with password ‘postgres’;”
以下只在coordinator节点执行
第八步:Add worker node information
sudo -i -u postgres psql -c “SELECT * from master_add_node(‘worker1’, 5432);”
sudo -i -u postgres psql -c “SELECT * from master_add_node(‘worker2’, 5432);”
第九步:Verify that installation has succeeded
[root@coordinator ~]# sudo -i -u postgres psql -c “SELECT * FROM master_get_active_worker_nodes();”
node_name | node_port
-----------±----------
worker2 | 5432
worker1 | 5432
(2 rows)
示例:
1、连接postgresql数据库,创建一张表test_table
2、配置分片策略:
SELECT master_create_distributed_table(‘test_table’, ‘id’, ‘hash’);
3、配置分片操作(将表分为2片,每个分片有两个副本)
SELECT master_create_worker_shards(‘test_table’, 2, 2);
4、装载数据
5、查看分片
SELECT * from pg_dist_shard;
6、查看分片分布
SELECT * from pg_dist_shard_placement order by shardid, placementid;
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:3.安装Oracle RAC-3.5.安装oracle11gr2 database 软件与创建数据库
- centos6.5下安装redis并集群
- 基于CentOS7开发之路 --- 第四章 :CentOS 7 安装 postgresql 9.5.0 数据库
- centos 下源码安装postgresql 9.4
- CentOS系统下的Hadoop集群(第5期)_Hadoop安装配置
- CentOS7(mini) 安装 Kubernetes 集群(kubeadm方式)
- centos 7 官网安装 PostgreSQL
- centos 安装postgresql 完整版
- CENTOS6.5环境下POSTGRESQL的安装与配置总结以及远程连接问题的解决
- Hadoop集群(第1期)_CentOS安装配置
- Centos6.7 + CDH5.4.5 HADOOP 集群环境离线安装
- centos7下postgresql9.6安装
- Linux安装Spark集群(CentOS7+Spark2.1.1+Hadoop2.8.0)
- CentOS/Linux Redis集群安装
- centos6.3下安装Postgresql安装与配置
- CentOS 6.5下搭建hadoop 2.6.0集群(一):安装配置JDK
- CentOS 6.8 minimal版本安装RocketMQ集群
- CentOS 6.3下PostgreSQL 的安装与配置
- centos6.4下CDH5.7.1集群的安装
- centos7 rabbitmq集群安装配置管理