GreenPlum 介绍 - client认证、限制并发、SSL连接

设置client认证

要从远端连接GP,修改配置文件 pg_hba.conf (标准PostgreSQL host-basedauthentication文件)
虽然在master和segment都存在pg_hba.conf,但是只要修改master就可以了。client只能连接master,从来不需要直连segment。

pg_hba.conf的内容远端访问格式如下:
local             database  user auth-method  [auth-options]
host              database  user CIDR-address  auth-method [auth-options]
hostssl       database  user CIDR-address  auth-method [auth-options]
hostnossl   database user  CIDR-address auth-method  [auth-options]
host             database  user IP-address  IP-mask auth-method  [auth-options]
hostssl       database  user IP-address  IP-mask auth-method  [auth-options]
hostnossl  database user  IP-address IP-mask  auth-method [auth-options]

 

解释:
[local] - 使用unix-domain socket连接
[host] - 使用TCP/IP连接,host包含SSL和non-SSL连接
[hostssl] - 使用TCP/IP连接, 只接受SSL加密连接
[hostnossl] - 使用TCP/IP连接, 接受non-ssl连接
[database] - 数据库名称,all表示全部数据库,多个数据库用逗号分隔
[user] -数据库用户,all表示全部数据库,多个数据用逗号分隔,+表示role或group的成员,@表示来源于外部文件
[CIDR-address] - CIDR地址,如:172.20.143.89/32 ,"/"前面是ip地址,后面是子网掩码 (仅用于host, hostssl, and hostnossl)
[IP-address]/[IP-mask] - 跟CIDR-address是一样,只是2种表示方式 (仅用于 host,hostssl, and hostnossl)
[auth-method] - 包含选项有:trust/reject/md5/password/gss/sspi/krb5/ident/ldap/radius/cert/pam
  使用较多的: trust(不需要任何验证)

              reject(拒绝任何请求)

              md5(需要提供MD5加密的密码)

              password(非加密的密码)

              ident(OS用户本地连接)
(注:线下可以使用trust,线上必须把trust设置去掉)

 

修改完配置文件,需要执行: $ gpstop -u

 

官方示例如下:

# Allow any user on the local system to connect to any databasewith
# any database user name using Unix-domain sockets (the default forlocal
# connections).
#
# TYPE DATABASE       USER           CIDR-ADDRESS           METHOD
local  all            all                                    trust

# The same using local loopback TCP/IP connections.
#
# TYPE DATABASE       USER           CIDR-ADDRESS           METHOD
host   all            all            127.0.0.1/32           trust

# The same as the previous line, but using a separate netmaskcolumn
#
# TYPE DATABASE       USER           IP-ADDRESS     IP-MASK            METHOD
host   all            all            127.0.0.1      255.255.255.255    trust

# Allow any user from any host with IP address 192.168.93.x toconnect
# to database "postgres" as the same user name that ident reportsfor
# the connection (typically the operating system user name).
#
# TYPE DATABASE       USER           CIDR-ADDRESS           METHOD
host  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章