为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 md5md5做密码验证比trust更安全,记得提前在PostgreSQL里创建好hive用户和对应的hive数据库哦。 - 修改完
pg_hba.conf后,必须重启PostgreSQL服务才能让配置生效:systemctl restart postgresql - 如果需要远程连接PostgreSQL,还要在
postgresql.conf里把listen_addresses设置为'*',不然PostgreSQL只会监听本地端口。
内容的提问来源于stack exchange,提问作者ScalaBoy
相关产品推荐
相关产品推荐

