CCA175 的 Sqoop/Hive:获取 table AlreadyExistsException
Sqoop / Hive for CCA175: getting table AlreadyExistsException
我正在准备我的 CCA175 考试。我正在尝试将 mysql 数据库 retail_db
导入到 hive
但出现此错误。我试了几次,也从这些文件夹中删除了目录/文件;
/user/hive/warehouse
/user/cloudera
在 运行 这个 sqoop
作业之后,我仍然收到以下错误:
sqoop import-all-tables \
--num-mappers 1 \
--connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" \
--username=retail_dba \
--password=cloudera \
--hive-import \
--hive-overwrite \
--create-hive-table \
--compress \
--compression-codec org.apache.hadoop.io.compress.SnappyCodec \
--outdir java_files
Logging initialized using configuration in
jar:file:/usr/jars/hive-common-1.1.0-cdh5.7.0.jar!/hive-log4j.properties
FAILED: Execution Error, return code 1 from
org.apache.hadoop.hive.ql.exec.DDLTask.
AlreadyExistsException(message:Table categories already exists)
如有任何帮助,我们将不胜感激。
您的 hive 默认数据库中似乎已经有类别 table。您需要从 Hive 中删除 tables。以下是步骤:
登录 mysql 并检查 retail_db 包含多少 table
的。
mysql> use retail_db;
mysql> show tables;
登录 hive 并检查 retail_dba (mysql) 中的哪些 table 存在?
删除存在于配置单元中的 tables。在你的例子中,它的类别
hive> show tables;
hive> drop table categories;
导航到cloudera首页,看看你是否已经
具有与这些 table 对应的目录。因为作为一部分
Sqoop导入Hive,数据临时复制到/user/cloudera/下的HDFS上,然后再移动到Hive仓库位置。为了
例如,检查类别目录。
[cloudera@quickstart /]$ hadoop fs -ls /user/cloudera/categories
从 sqoop 命令中删除 --create-hive-table。
根据 sqoop 文档,如果 table 已存在同名,作业将失败。
--create-hive-table 如果设置了,那么如果目标hive job会失败
table 退出。默认情况下,此 属性 为 false
我正在准备我的 CCA175 考试。我正在尝试将 mysql 数据库 retail_db
导入到 hive
但出现此错误。我试了几次,也从这些文件夹中删除了目录/文件;
/user/hive/warehouse
/user/cloudera
在 运行 这个 sqoop
作业之后,我仍然收到以下错误:
sqoop import-all-tables \
--num-mappers 1 \
--connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" \
--username=retail_dba \
--password=cloudera \
--hive-import \
--hive-overwrite \
--create-hive-table \
--compress \
--compression-codec org.apache.hadoop.io.compress.SnappyCodec \
--outdir java_files
Logging initialized using configuration in jar:file:/usr/jars/hive-common-1.1.0-cdh5.7.0.jar!/hive-log4j.properties FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. AlreadyExistsException(message:Table categories already exists)
如有任何帮助,我们将不胜感激。
您的 hive 默认数据库中似乎已经有类别 table。您需要从 Hive 中删除 tables。以下是步骤:
登录 mysql 并检查 retail_db 包含多少 table 的。
mysql> use retail_db; mysql> show tables;
登录 hive 并检查 retail_dba (mysql) 中的哪些 table 存在? 删除存在于配置单元中的 tables。在你的例子中,它的类别
hive> show tables; hive> drop table categories;
导航到cloudera首页,看看你是否已经 具有与这些 table 对应的目录。因为作为一部分 Sqoop导入Hive,数据临时复制到/user/cloudera/下的HDFS上,然后再移动到Hive仓库位置。为了 例如,检查类别目录。
[cloudera@quickstart /]$ hadoop fs -ls /user/cloudera/categories
从 sqoop 命令中删除 --create-hive-table。
根据 sqoop 文档,如果 table 已存在同名,作业将失败。
--create-hive-table 如果设置了,那么如果目标hive job会失败 table 退出。默认情况下,此 属性 为 false