安裝pg10 一、install yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm yum install postgre ...
安裝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
)
五、安裝定時任務