HAWQ配置之客户端访问

时间:2024-06-07 20:06:26

一、配置简单的口令访问

1,建立数据库和用户

postgres=# create database epbd;
CREATE DATABASE
postgres=# create role user1 with login;
NOTICE: resource queue required -- using default resource queue "pg_default"
CREATE ROLE
postgres=# alter role user1 with password 'user1';
ALTER ROLE
postgres=# grant all on epbd to user1;
ERROR: relation "epbd" does not exist
postgres=# grant all on database epbd to user1;
GRANT

2,修改master访问配置文件pg_hba.conf,添加一个口令访问用户

local    all         gpadmin         ident
host all gpadmin 127.0.0.1/ trust
host all gpadmin ::/ trust
host all gpadmin 192.168.58.15/ trust
host all gpadmin fe80::4ecc:6aff:fe93:/ trust
host all gpadmin 192.168.58.11/ trust
local all yh password
host all user1 192.168.0.0/16 password

3,重载配置文件使之生效

 hawq stop cluster -u -a -M fast

注意这个命令并非停止集群,只是为了重新装载配置。