Ranger错误:Unable to connect to Hive Thrift Server instance..

来源:互联网 发布:女装知茵品牌 编辑:程序博客网 时间:2024/05/18 12:42
Ranger测试hive连接错误提示:
org.apache.ranger.plugin.client.HadoopException: Unable to connect to Hive Thrift Server instance.. 
Unable to connect to Hive Thrift Server instance.. 
Could not open client transport for any of the Server URI's in ZooKeeper: Could not establish connection to jdbc:hive2://c2bde55:10000/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default}). 
Could not establish connection to jdbc:hive2://c2bde55:10000/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default}). 

Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default}). 


解决办法:
使用hdp2.6.1出现,原因是hive相关jar包不匹配问题
1)备份目录:
# cd /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/
# cp -r hive hive.bak
2)清空,重新拷贝hive jar包和它的依赖包
rm -rf /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive/*
cp -r /usr/hdp/2.6.1.0-129/hive/lib/hive-common*.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
cp -r /usr/hdp/2.6.1.0-129/hive/lib/hive-jdbc*.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
cp -r /usr/hdp/2.6.1.0-129/hive/lib/hive-exec*.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
cp -r /usr/hdp/2.6.1.0-129/hive/lib/hive-metastore*.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
cp -r /usr/hdp/2.6.1.0-129/hive/lib/hive-service*.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
cp -r /usr/hdp/2.6.1.0-129/hive/lib/libfb303*.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
cp -r /usr/hdp/2.6.1.0-129/hive/lib/libthrift*.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
chmod -R a+x /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
cp ../hive.bak/ranger-hive-plugin-0.7.0.2.6.1.0-129.jar /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive/
3) 改变拥有者
chown -R ranger:ranger /usr/hdp/2.6.1.0-129/ranger-admin/ews/webapp/WEB-INF/classes/ranger-plugins/hive
4)重启ranger服务,然后测试连接。


注明:此方法通过Ranger授权无效,不建议使用,因为Ranger插件默认使用的是hive2,所以需Ambari中hive组件开启HiveServer2 Interactive

同时修改Ranger中hive服务的jdbc.url *值为:

jdbc:hive2:/ip:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2-hive2

阅读全文
0 0
原创粉丝点击