Ambari Hive 创建函数无权限

櫰木2年前技术文章1081

1、创建udf函数

参考文档:https://blog.csdn.net/helloxiaozhe/article/details/102498567

如果已经编写好,请使用自己的。如果没有请参考以上链接进行udf函数编写

2、创建函数遇到的问题

由于集群开启了kerberos,但是没有开启ranger,导致用户没有权限创建函数。出现以下问题

3、解决方案

修改或添加以下配置

hdp配置文件目录:/usr/hdp/current/hive-server2/conf/hiveserver2-site.xml

  
    <property>
      <name>hive.security.authenticator.manager</name>
      <value>org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator</value>
    </property>
  
    <property>
      <name>hive.security.authorization.enabled</name>
      <value>true</value>
    </property>
  
    <property>
      <name>hive.security.authorization.manager</name>
      <value>org.apache.hadoop.hive.ql.security.authorization.plugin.fallback.FallbackHiveAuthorizerFactory</value>
    </property>

3.png

hdp配置文件目录:/usr/hdp/current/hive-server2/conf/hive-site.xml

    <property>
      <name>hive.users.in.admin.role</name>
      <value>hive</value>
    </property>
    <property>
      <name>hive.security.authorization.createtable.owner.grants</name>
      <value>ALL</value>
    </property>
    <property>
      <name>hive.security.authorization.task.factory</name>
      <value>org.apache.hadoop.hive.ql.parse.authorization.HiveAuthorizationTaskFactoryImpl</value>
    </property>

4.png

4、验证

由于配置文件中写的是hive用户为admin。

使用kinit 认证hive keytab。拥有所有权限

kinit  hive/hdp01@HADOOP.COM  -kt /etc/security/keytabs/hive.service.keytab

5.png

CREATE FUNCTION manghello AS 'org.dtstack.HelloUDF' USING JAR 'hdfs://ha/tmp/udf/helloudf-1.0-SNAPSHOT.jar';

6.png

使用udf函数

 select manghello('zhang','sancc');

7.png

使用nn用户认证。进行创建函数就会报错

kinit -kt nn.service.keytab  nn/hdp01@HADOOP.COM


相关文章

sql_mode参数

sql_mode参数

一、参数含义sql_mode是个很容易被忽视的变量,其本身主要就是一种语法校验规则 ,默认值是空值,在这种设置下是可以允许一些非法操作的,比如允许一些非法数据的插入。二、常用值含义1、ONLY_FUL...

Hive合并小文件:hive归档(archive)

Hive合并小文件:hive归档(archive)

一、概述       在HDFS中数据和元数据分别由DataNode和NameNode负责,这些元数据每个对象一般占用大约150个字节。大量的小文件相对于大文件会占用大量的NameNode内存。对Na...

证书过期问题之IPV6协议

证书过期问题之IPV6协议

1、首先了解情况:客户的SSL/TLS证书要过期了,所以进行了证书替换工作,但是替换之后,有一部分客户端还是提示证书已过期,如图所示:2、看这个报错是非常的清晰的,就是证书过期的问题,但是为什么同事没...

dolphinscheduler部署-FAQ

dolphinscheduler部署-FAQ

如果是cdh集群会遇到一个问题5678端口被占用这是因为cdh的agent用了5678那我们改下配置文件文件:/opt/apache-dolphinscheduler-3.1.8-bin/st...

trino容器对接hudi(五)

trino容器对接hudi(五)

前提:本文是基于已经部署了trino容器的基础上进行的。冒烟测试是在trino对接ldap后并且ranger已经对接了metastore权限后,并且spark组件已经对接hudi,并且成功创建hudi...

Wireshark工具使用

Wireshark工具使用

一、介绍wireshark是一款免费、开源的网络抓包工具。项目地址如下:https://github.com/wireshark/wireshark应用如下:1. 网络管理员会使用wireshark来...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。