Sqoop使用常常遇到问题

一、sqoop 导入hive数据

(1)空字符串, 空对象处理 

--null-string '\\N' --null-non-string '\\N'java

(2)导入数据含有特殊字符

--hive-drop-import-delims数据库

(3)导入时 用query查询

target-dir 必定不要与数据库最终保存位置一致app

二、sqoop 导出到MySQL

(1)导入时定义过空对象、空字符创处理、

--input-null-string '\\N'--input-null-non-string '\\N'oop

(2)mapper100%,reduce卡在0%

id主键冲突,由特殊字符致使hdfs文件格式有问题\spa

(3)export导出,增量更新

update-key update-mode对象

例子: --update-key id --update-mode allowinsert字符串

两种模式: allowinsert : 若是key是主键,则MySQL存在则更新,不存在则插入;不是主键,则插入;get

                updateonly : 只会更新,不会插入;input

三、使用java调用

(1)必定要注以特殊字符转义 

\\N  \\\\\\Nstring

相关文章
相关标签/搜索