os: centos 7.4
gp: gpdb-5.7.0
三台机器
node1 为 master host
node2、node3 为 segment host
psql 登录 master
node1 上操作
# su - gpadmin
$ psql -d peiybdb
psql (8.3.23)
Type "help" for help.
peiybdb=# l
List of databases
Name | Owner | Encoding | Access privileges
-----------+---------+----------+---------------------
peiybdb | gpadmin | UTF8 |
postgres | gpadmin | UTF8 |
template0 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
template1 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
(4 rows)
peiybdb=# c
You are now connected to database "peiybdb" as user "gpadmin".
peiybdb=# select now();
now
------------------------------
2018-05-02 06:55:25.99893+00
(1 row)
node1 上操作,修改 pg_hba.conf
$ cd /u01/greenplum-data/gpseg-1/
$ vi pg_hba.conf
host all gpadmin 192.168.56.1/32 md5
host all gpadmin 192.168.165.1/32 md5
$ psql -d peiybdb
psql (8.3.23)
Type "help" for help.
peiybdb=#
peiybdb=# select pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
psql 登录 segment
node2 或者 node3 上操作
# su - gpadmin
$ PGOPTIONS='-c gp_session_role=utility' psql -p 40000 -d peiybdb
psql (8.3.23)
Type "help" for help.
peiybdb=#
peiybdb=# select now();
now
-------------------------------
2018-05-02 13:01:55.307143+00
(1 row)
peiybdb=# select current_database();
current_database
------------------
peiybdb
(1 row)