记 hive jdbc访问 开通

hiveserver2

是Hive启动了一个server,客户端可以使用JDBC协议,通过IP+ Port的方式对其进行访问,达到并发访问的目的。
1.启动hiveserver2服务
启动Hive有两条命令:$HIVE_HOME/bin/./hive --service hiveserver2 或者
$HIVE_HOME/bin/./hiveserver2,hiveserver2的服务端口默认是10000,WebUI端口默认是10002,在终端使用命令netstat -anop|grep 10000 和 netstat -anop|grep 10002:
在这里插入图片描述查看WebUI:
在这里插入图片描述
hiveserver2服务启动成功。
用beeline连接:
如果端口错误,例如连接10002:
在这里插入图片描述

Error: Could not open client transport with JDBC Uri: jdbc:hive2://10.10.6.100:10002: Invalid status 72 (state=08S01,code=0)

如果用户名密码错误:

Error: Could not open client transport with JDBC Uri: jdbc:hive2://cdh3:10000/default: Peer indicated failure: Error validating the login (state=08S01,code=0)

如果都没问题,然而还是报错:

在这里插入图片描述

Error: Could not open client transport with JDBC Uri: jdbc:hive2://10.10.6.100:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate testgroup (state=08S01,code=0)

把hive-site配置里的hive.server2.enable.doAs设置成false,让查询以运行hiveserver2进程的用户执行,这样就有权限了,如下图,去掉勾选。
在这里插入图片描述
之后还是报了另一个错:

Error: Could not open client transport with JDBC Uri: jdbc:hive2://10.10.6.105:10000: Failed to open new session: java.lang.IllegalArgumentException: Cannot modify hive.query.redaction.rules at runtime. It is not in list of params that are allowed to be modified at runtime (state=08S01,code=0)

报错提及can not modify hive.query.redaction.rules
去查看这个在哪儿:
cd /etc/hive
grep -rni “hive.query.redaction.rules”
在这里插入图片描述
去掉配置文件中 hive-env.sh 中第7行加载了这个配置项hive.query.redaction.rules校验参数。

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值