首先安装citus和postgresql的yum源。
## 安装citus源 curl https://install.citusdata.com/community/rpm.sh | sudo bash
## 配置postgresql源 vim /etc/yum.repos.d/pgdg-95-centos.repo [pgdg95] name=PostgreSQL 9.5 $releasever - $basearch baseurl=https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-$releasever-$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95 [pgdg95-source] name=PostgreSQL 9.5 $releasever - $basearch - Source failovermethod=priority baseurl=https://download.postgresql.org/pub/repos/yum/srpms/9.5/redhat/rhel-$releasever-$basearch enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95
安装citus和postgresql
yum install -y citus_95 rm -rf /var/lib/pgsql/9.5/data/ mkdir /data/pgsql/data/ -p chown postgres:postgres -R /data/pgsql/data/ ln -s /data/pgsql/data/ /var/lib/pgsql/9.5/
初始化citus,需要在root用户下执行。
/etc/init.d/postgresql-9.5 initdb
预加载citus扩展
echo "shared_preload_libraries = ‘citus‘" | sudo tee -a /var/lib/pgsql/9.5/data/postgresql.conf
修改配置文件中的监听地址
## vim /var/lib/pgsql/9.5/data/postgresql.conf listen_addresses = ‘*‘
配置远程访问的权限
## vim /var/lib/pgsql/9.5/data/pg_hba.conf host all postgres 10.10.0.0/16 md5
启动postgresql服务
/etc/init.d/postgresql-9.5 start
创建citus的扩展
sudo -i -u postgres psql -c "CREATE EXTENSION citus;"
时间: 2024-11-11 21:43:25