栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

sqoop

sqoop

hive数据导出到mysql: export --connect “jdbc:mysql://localhost:3306/test” --username root --password 123456 --table emp --export-dir /user/hive/warehouse/student.db/emp/ --input-null-string “N” --input-null-non-string “N” --fields-terminated-by “01”
mysql数据导入hive: import --connect “jdbc:mysql://localhost:3306/test” --username root --password 123456 --table hcat --target-dir /user/hdfs/hcat/ --delete-target-dir --fields-terminated-by “t” --hive-import --hive-overwrite --hive-database common -m10

数据导入hive参数:
-hive-home

重写$HIVE_HOME
-hive-import 插入数据到hive当中,使用hive的默认分隔符
-hive-overwrite 重写插入
-create-hive-table 建表,如果表已经存在,该操作会报错!
-hive-table 设置到hive当中的表名
-hive-drop-import-delims 导入到hive时删除 n, r, and 001
-hive-delims-replacement 导入到hive时用自定义的字符替换掉 n, r, and 001
-hive-partition-key hive分区的key
-hive-partition-value hive分区的值
-map-column-hive 类型匹配,sql类型对应到hive类型

hive空值处理
sqoop会自动把NULL转换为null处理,但是hive中默认是把N来表示null,因为预先处理不会生效的,我们需要使用 -null-string 和 -null-non-string来处理空值 把N转为N
例句:sqoop import … -null-string ‘N’ 或-null-non-string ‘N’

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/650896.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号