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校验参数。