【发布时间】:2016-06-13 19:48:01
【问题描述】:
我使用的是gp 4.3.7.2,我按照手册http://120.52.72.46/gpdb.docs.pivotal.io/c3pr90ntcsf0/gs/43/pdf/GPDB43xGettingStarted.pdf
我可以使用管理员用户连接到服务器,但是当我尝试使用其他用户时,我收到错误消息
psql: FATAL: no pg_hba.conf entry for host "[local]", user "gpuser", database "rdw", SSL off
我已经对 stackoverflow 做了一些研究。我修改了pg_hba.conf,添加一个条目
host all all 0.0.0.0/0 md5
然后用gpstop -u和SELECT pg_reload_conf();重新加载配置文件,甚至尝试重新启动gp服务器。但我仍然遇到同样的错误。
我还尝试了其他条目,例如
host all all 127.0.0.1/32 md5
这也没有用。
请告诉我如何解决这个问题。
编辑:
我以单节点模式重新安装了数据库,并完全按照前面提到的手册进行操作。我创建了两个用户:user1、user2 并将角色users 授予这两个用户。
我执行了什么:
在命令行中:
$ createuser -P user1
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
在 psql 中:
=# CREATE USER user2 WITH PASSWORD 'changeme' CREATEDB NOSUPERUSER;
=# CREATE ROLE users;
=# GRANT users TO user1, user2;
这是我的整个 pg_hba.conf,位于/data/gp/server/master/gpsne-1/pg_hba.conf。我添加了最后 3 行。
local all hadoop ident
host all hadoop 127.0.0.1/28 trust
host all hadoop 10.10.10.32/32 trust
host all hadoop ::1/128 trust
host all hadoop fe80::d6ae:52ff:feb9:87c2/128 trust
local replication hadoop ident
host replication hadoop samenet trust
local tutorial +users md5
local tutorial +users 127.0.0.1/28 md5
hostssl tutorial +users samenet md5
但我仍然遇到同样的错误。
psql: FATAL: no pg_hba.conf entry for host "[local]", user "user1", database "tutorial", SSL off
当我安装数据库时,我收到一条警告消息,不确定是否相关。
20160302:10:44:51:023434 gpinitsystem:bobcat04:hadoop-[WARN]:-Host 127.0.0.1 is assigned as localhost in /etc/hosts
20160302:10:44:51:023434 gpinitsystem:bobcat04:hadoop-[WARN]:-This will cause segment->master communication failures
20160302:10:44:51:023434 gpinitsystem:bobcat04:hadoop-[WARN]:-Remove 127.0.0.1 from local host line in /etc/hosts
【问题讨论】:
-
您添加的条目似乎正确。问题一定出在其他地方。也许您更改了错误的“pg_hba.conf”文件,或者没有重新启动服务器。
-
"[local]" 在 Unix 域套接字中?这需要“本地”而不是“主机”。
-
请发布您的整个 pg_hba.conf,但不要包含 cmets。
-
@A.Scherbaum 谢谢你的建议,我提供更多细节。
标签: postgresql greenplum