You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为Hive配置PostgreSQL时遇报错:no pg_hba.conf entry for host

为Hive配置PostgreSQL的pg_hba.conf配置示例

嘿,我正在尝试给Hive配置PostgreSQL作为元数据存储,下面是我当前的/var/lib/pgsql/data/pg_hba.conf文件内容:

# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local   all             postgres                                trust
# IPv4 local connections:
host    all             postgres        127.0.0.1/32            trust
# IPv6 local connections:
host    all             postgres        ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident

实用配置小贴士

  • 当前配置仅允许本地(127.0.0.1/::1)的postgres用户无密码访问所有数据库。如果Hive运行在其他机器上,得新增一条规则,比如允许Hive主机访问专属的元数据库:
    host    hive            hive            [你的Hive主机IP]/32            md5
    
    这里用md5做密码验证比trust更安全,记得提前在PostgreSQL里创建好hive用户和对应的hive数据库哦。
  • 修改完pg_hba.conf后,必须重启PostgreSQL服务才能让配置生效:
    systemctl restart postgresql
    
  • 如果需要远程连接PostgreSQL,还要在postgresql.conf里把listen_addresses设置为'*',不然PostgreSQL只会监听本地端口。

内容的提问来源于stack exchange,提问作者ScalaBoy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 04:04:25