这个是专门记录大数据学习工作中遇见的问题的👀👀
在搭建分布式hive时,启动hive客户端查询数据库时发现出现了一下错误:
hive> show databases; FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClienthive> show databases; FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
原因是在修改配置文件hive-site.xml时使用的是远程模式,服务器的地址写错了,原本是写hive server地址,thrift://slave01:9083,被我写成了本机的客户端的地址 thrift://slave02:9083
xml <property>
<name>hive.metastore.uris</name>
<value>thrift://slave01:9083</value>
<value/>
<description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
</property>
修改成功后启动客户端,发现可以查询出数据了,可是后面又出现了一行记录
hive> show databases; OK Failed with exception java.io.IOException:java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:user.name%7D Time taken: 2.115 seconds
上网查询解决方案
xml <property>
<name>hive.exec.local.scratchdir</name>
<value>/opt/hive/tmp/${system.user.name}</value>
<description>Local scratch space for Hive jobs</description>
</property>
将以上配置修改成以下配置
<property>
<name>hive.exec.local.scratchdir</name>
<value>/opt/hive/tmp/${user.name}</value>
<description>Local scratch space for Hive jobs</description>
</property>
这样就完美解决问题
启动hive --service matestore 时 显示错误 “Address already in use”
产生该问题的原因时,hive启动时的端口被占用,去要我们手动去关闭占用的进程
第一步:查看端口是被哪个进程占用的
命令:netstat -apn | grep 端口号
第二步:杀掉进程
命令: kill -9 pid
重新启动hive --service matestore 就能ok了
启动hive --service matestore时显示以下报错
org.datanucleus.store.rdbms.connectionpool.DatastoreDriverNotFoundException: The specified datastore driver ("com.mysql.cj.jdbc.Driver") was not found in the CLASSPATH. Please check your CLASSPATH specification, and the name of the driver.
产生该问题的原因是因为hive lib库没有对应的mysql-connector-java-xxx-bin.jar 包
解决方法:可从网上或者maevn本地仓库拷贝一份到hive 的lib库即可
启动hive --service matestore时显示以下报错
java.net.NoRouteToHostException: No Route to Host
原因是因为没有找到主机地址,这可能是因为防火墙没有关闭的原因,解决步骤
systemctl status firewalld #查看防火墙状态 systemctl stop firewalld #关闭防火墙 systemctl disable firewalld #开机不自启动
这样就可以解决该问题。
解决方法1:检查虚拟机网卡 IPADDR 、NETMASK、GATEWAY、DNS、ONBOOT等配置是否正确,如果错误请进行修改,修改后就可以连接xshell7
解决方法2:windows 点击 “网络和Internet设置” -------> "高级网络设置" -------> “VMnet8” -------> “编辑” -------> “Internet协议版本4” -------> "使用下面的IP地址",IP填写为虚拟机的网关地址,并填写对应的子网掩码。此时打开xshell7连接即可
解决方法3:vm主页点击“编辑” -------> “虚拟网络编辑器” -------> ”更改设置“ -------> ”还原默认设置“ 还原完成后记得把网段改为原来的即可。
本文作者:苏皓明
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!