美文网首页
Presto + Ambari Hive 问题

Presto + Ambari Hive 问题

作者: alaya_c09d | 来源:发表于2019-08-02 19:25 被阅读0次

环境

Ambari HDFS,Hive, Ranger
Presto

Hive 表中数据库为tableautest,表msg_push,其路径权限如下

[umecron@umetrip-hdp26-147xxx ~]$ hadoop fs -ls /apps/hive/warehouse/tableautest.db
Found 4 items
drwxrwxrwx   - umecron hadoop          0 2019-03-19 19:35 /apps/hive/warehouse/tableautest.db/flt_status
drwx--x--x   - hdfs    hadoop          0 2019-03-19 19:35 /apps/hive/warehouse/tableautest.db/msg_push
drwxrwxrwx   - umecron hadoop          0 2019-03-19 19:37 /apps/hive/warehouse/tableautest.db/pnr
drwxrwxrwx   - umecron hdfs            0 2019-04-28 10:56 /apps/hive/warehouse/tableautest.db/testformat

问题

无论以何种用户启动Presto以及其Cli,查询表msg_push时都提示要以“hive”用户访问HDFS路径。


图片 1.png 图片 2.png

尝试一:Presto 官网文档
https://prestodb.github.io/docs/current/connector/hive.html

图片 3.png

修改/opt/app/presto-server/etc/jvm.config


图片 4.png

重启Presto,命令: ./launcher.py restart


图片 5.png

进程显示HADOOP_USER_NAME已指定,但通过presto cli 查询msg_push仍然报相同错误。。。

尝试二:根据Presto文档https://prestodb.github.io/docs/current/connector/hive-security.html

图片 6.png

设置/opt/app/presto-server/etc/catalog/hive.properties

图片 7.png

重启Presto,通过presto cli 查询msg_push仍然报相同错误。。。

尝试三:
由于presto cli命令行中错误信息有限,尝试通过Presto监控UI 查看报错信息,是否有其他额外信息。


图片 8.png

点击该查询项,查看详细信息

http://10.5.XXX.XXX:8084/ui/query.html?20190731_050335_00003_6kt66

图片 9.png

红框中显示有关于hive metastore的信息。

回忆尝试一中文档关于hive metastore部分:

https://prestodb.github.io/docs/current/connector/hive.html

图片 10.png

其中有参数hive.metastore.username,尝试下。

设置/opt/app/presto-server/etc/catalog/hive.properties

图片 11.png

重启Presto后,查询成功!

貌似解决问题了??
按照之前理解Presto读取HDFS目录时,是以启动Presto进程的用户来读取的:“Presto will access HDFS using the OS user of the Presto process”,并且可以通过设置HADOOP_USER_NAME来指定用户。但现在好像只能通过设置hive.metastore.username,来修改访问HDFS的用户。而且根据文档解释,该参数是访问Hive metastore的用户:“The username Presto will use to access the Hive metastore.”

后来看到https://community.hortonworks.com/questions/76812/ranger-and-hiveserver2enabledoas-configuration.html
是由于Ambari集群中启用Ranger时,参数设置为了hive.server2.enable.doAs=false,导致无论客户端以哪个用户启动,实际都以hive用户访问HDFS。

相关文章

网友评论

      本文标题:Presto + Ambari Hive 问题

      本文链接:https://www.haomeiwen.com/subject/nbdrdctx.html