postgresql - 无法连接到 greenplum,错误消息为 : "no pg_hba.conf entry"

标签 postgresql greenplum

我使用的是 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 -uSELECT 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

最佳答案

倒数第二行有误:

local tutorial +users 127.0.0.1/28 md5

不应为本地连接列出 IP 地址。

您是否在进行更改后运行了 gpstop -u 以重新加载? 我怀疑由于行无效导致重新加载失败。

删除该行并再次运行 gpstop -u 并尝试再次连接。

关于postgresql - 无法连接到 greenplum,错误消息为 : "no pg_hba.conf entry",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35722132/

相关文章:

apache-spark - Spark Streaming 加入 GreenPlum/Postgres 数据。方法

scala - 用于 TB 级结构化数据的 Greenplum、Pivo​​tal HD + Spark 或 HAWQ?

单连接上带有事务 block 的 Python Postgres 查询

django - 我如何修复docker-compose.yml,在使用Django安装Mayan-EDMS时出错

postgresql - 自定义 postgres shared_preload_libraries 目录 - 如何配置?

sql - 如何查询 JSONB 字段字典中的值数组?

java - maven intellij java mapreduce 测试程序

ubuntu - 如何在 Ubuntu 14.04 LTS 中安装 Greenplum 数据库?

postgresql - 在 PostgreSQL 中恢复 postgres 用户

c# - 更新大量数据时重复键值错误