導入語句
sqoop import
–connect jdbc:mysql://zjy:3306/company
–username root
–password zjy123zjy --table staff1
–split-by id
–hive-import
–create-hive-table
–hive-table staff_hive;
然後出現下面的場景
沒報錯 以爲成功了 就去hive裏面去看發現什麼都沒有
怎麼回事兒
經過一番探索發現
因爲我在hive的客戶端執行 可能是因爲sqoop/conf下的
hive-site-xml配置有錯誤 導致的
看了看 發現果然出錯 之前複製了hive/conf/hive-site-xml 到sqoop/conf/下
但之後對hive中的hive-site-xml做了修改 sqoop/conf下的沒更新
於是我就 更新這個文件 果然成功了
總結
1 就在hive的服務端執行 就不會出現這個問題
2 在客戶端執行 要配置好hive-site.xml 並複製到sqoop/conf/下
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://zjy2:9083</value>
</property>
<property>
<name>hive.exec.mode.local.auto</name>
<value>true</value>
</property>