Sqoop的使用
将hive客户端的hive-site.xml复制到$SOOP_HOME/conf目录下,不然会提示hive自己建的数据库不存在
全节点:zkServer.sh start cdh1: start-dfs.sh cdh1: start-yarn.sh cdh3: yarn-daemon.sh start resourcemanager hive客户端节点:sqoop import --connect jdbc:mysql://cdh3:3306/mycdh --username root --password 147258 --table DemoDate --delete-target-dir --hive-database datademo --hive-import --hive-overwrite --create-hive-table --hive-table sqDemoDate --m 3
//成功 hive (datademo)> show tables; OK tab_name demo sqdemodate Time taken: 0.115 seconds, Fetched: 2 row(s) hive (datademo)> select * from sqdemodate; OK sqdemodate.id sqdemodate.starttime sqdemodate.endtime sqdemodate.diff sqdemodate.indate 1 2022-02-24 2022-02-26 3 2022-02-26 17:22:26.0 2 2022-02-20 2022-02-23 2 2022-02-26 17:22:26.0 3 2022-02-04 2022-02-06 1 2022-02-26 17:22:26.0 4 2022-02-12 2022-02-16 2 2022-02-26 17:22:26.0 5 2022-02-03 2022-02-08 2 2022-02-26 17:22:26.0 6 2022-02-21 2022-02-27 5 2022-02-26 17:22:26.0 7 2022-02-24 null 0 2022-02-26 17:41:56.0 Time taken: 4.181 seconds, Fetched: 7 row(s) hive (datademo)>
hive导出到MySQL
[root@cdh1 /]# sqoop export --connect jdbc:mysql://cdh3:3306/BigData --username root --password 147258 --table demo1
--export-dir '/hive/warehouse/bigdata.db/demo1' --fields-terminated-by '/001';
作者:M_Fight๑҉
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· 【.NET】调用本地 Deepseek 模型
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库