安装pg10

安装pg10

一、install

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

yum install postgresql10

yum install postgresql10-server

/usr/pgsql-10/bin/postgresql-10-setup initdb

systemctl enable postgresql-10

systemctl start postgresql-10

二、配置

修改/var/lib/pgsql/10/data目录下文件

cd /var/lib/pgsql/10/data

vi pg_hba.conf

host all all 127.0.0.1/32 trust

......

vi postgresql.conf

listen_addresses = '*'

port = 5432

max_connections = 2000

三、安装dblink

yum install postgresql10-contrib

su - postgres

/usr/pgsql-9.6/bin/psql 数据库实例名

进入sql命令或pgadmin执行sql窗口:

create extension dblink;

测试:需要在连接的数据库中配置IP白名单。

select * from dblink('hostaddr=127.0.0.1 port=5432 dbname=bolink user=postgres password=postgre','select id from tb limit 10')

as t(id int)

四、创建数据表

导入数据:

insert into tb

select * from dblink('hostaddr=127.0.0.1 port=5432 dbname=bolink user=postgres password=postgre',

'select * from tb where id between 1 and 10000')

as t(

id int,

text varchar

)

 

你可能感兴趣的:(安装pg10)