环境:
os : centos7.5
hadoop :3.0
hive: 3.0
sqoop: 1.5
mysql: 5.7
MySQL数据导入到hive,在通过zookeeper地址连接hive时,一直处于卡住状态,没有发现任何错误信息,经过一番查找,终于发现问题之根源。
首先,给一下我的导入命令:
sudo -u hdfs sqoop import –connect ‘\”jdbc:mysql://node1.test.com/test’\” –username test –password test –table test -m 4 –hive-table test.test –hive-import –hive-overwrite –validate –verbose –delete-target-dir –hive-drop-import-delims’
追踪发现数据通过mr跑完后存于hdfs上,刚要从hdfs上导入hive时,连接hive这里出现问题,一直卡住。
后来测试手动导入,没有问题。最后猜想是没有连接上hive,于是进入beeline,用!connect jdbc:hive2://node2.test.com:2181/default;发现需要输入用户名和密码,故问题就出来了。
解决方案:
在hive conf里需要需要创建一个xml文件(beeline-hs2-connection.xml ),添加以下内容:
<?xml version=”1.0″?>
<?xml-stylesheet type=”text/xsl” href=”configuration.xsl”?>
<configuration>
<property>
<name>beeline.hs2.connection.user</name>
<value>hdfs</value>
</property>
<property>
<name>beeline.hs2.connection.password</name>
<value>hdfs</value>
</property>
</configuration>
注意:文件名beeline-hs2-connection 不能改动。
感兴趣的同志可以访问我的个人博客:www.foot365.com.cn
Love sniffing, love technology --aisniff