【问题标题】:Sqoop syntax to overwrite hdfs in import all tables在导入所有表时覆盖 hdfs 的 Sqoop 语法
【发布时间】:2017-10-01 16:54:38
【问题描述】:

在我的 hdfs 中已经存在目录“mydatabase”,我正在尝试使用 sqoop 更新 mysql 中用于 hdfs 的数据

但是,在 import-all-tables 命令中,hdfs 目录中没有覆盖选项,仅在 hive 中

我正在尝试执行以下命令:

sqoop import-all-tables 
--connect jdbc:mysql://10.20.20.43/mydatabase 
--username blizzard 
--password blizzard 
--warehouse-dir /user/hdfs/mydatabase -m 1
--hive-database mydatabase
--hive-import 
--hive-overwrite
--null-string '\\N' 
--null-non-string '\\N' 
--verbose

但我有一个错误:

17/05/03 19:48:13 ERROR tool.ImportAllTablesTool: 
Encountered IOException running import job:
org.apache.hadoop.mapred.FileAlreadyExistsException: 
Output directory hdfs://10.20.20.43:8020/user/hdfs/mydatabase/table1
already exists

我总是想导入所有数据,因为我不知道哪一项可以更改。

最好的方法是什么?

谢谢!

编辑:

根据文档https://sqoop.apache.org/docs/1.4.6/SqoopUserGuide.html--delete-target-dir 命令仅适用于import,不适用于import-all-tables

【问题讨论】:

标签: hive hdfs sqoop


【解决方案1】:

您可以删除所有数据以重新重写它们。试一试:

$hdfs dfs -rm -r /user/hduser/*

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-22
    • 1970-01-01
    • 1970-01-01
    • 2019-07-12
    • 1970-01-01
    相关资源
    最近更新 更多