sqoop mysql导入hive报错_使用sqoop从mysql导入数据到hive

前言

这篇文章主要是用sqoop从mysql导入数据到hive时遇到的坑的总结。

环境:

系统:Centos 6.5

Hadoop:Apache,2.7.3

Mysql:5.1.73

JDK:1.8

Sqoop:1.4.7

Hadoop以伪分布式模式运行。

一、使用的导入命令

参照里面的方法,在mysql建了表,填充了数据,然后按照自己的情况输入了命令:

sqoop import --connect jdbc:mysql://localhost:3306/test --username root -P --split-by id --columns id,name --table customer --target-dir /user/cloudera/ingest/raw/customers --fields-terminated-by "," --hive-import --create-hive-table --hive-table sqoop_workspace.customers

然后开始了打地鼠之旅。

二、遇到的问题及解决

1. 用文本字段进行分区的问题

报错信息:"Generating splits for a textual index column allowed only in case of "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" property passed as a parameter"。

主要问题是“--split-by id”这个参数指定的id是一个文本格式,所以需要在命令中加入选项"-

你可能感兴趣的:(sqoop,mysql导入hive报错)