初次使用Sqoop报错,sqoop命令不能正常使用:hcatalog does not exist!accumulo does not exist!
阅读原文时间:2023年07月08日阅读:4

1、问题描述:

(1)问题示例:

[hadoop@master Tmp]$ sqoop  help
Warning: /home/grid/Sqoop/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/grid/Sqoop/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
No such sqoop tool: -help. See 'sqoop help'.
[hadoop@master Tmp]$ sqoop  version
Warning: /home/grid/Sqoop/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/grid/Sqoop/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
No such sqoop tool: -version. See 'sqoop help'.

(2)问题综述:

    Sqoop工具的命令:sqoop不能正常使用,连-help查看参数、-version显示版本信息都报错。

    问题的关键是:找不到,HCatalog和accumulo,这两个工具。

2、解决方案:

参考https://blog.csdn.net/weixin_43716338/article/details/106752816

(1)找到Sqoop的配置文件:configure-sqoop

(2)找到如下段代码:

## Moved to be a runtime check in sqoop.
if [ ! -d "${HCAT_HOME}" ]; then
echo "Warning: $HCAT_HOME does not exist! HCatalog jobs will fail."
echo 'Please set $HCAT_HOME to the root of your HCatalog installation.'
fi

if [ ! -d "${ACCUMULO_HOME}" ]; then
echo "Warning: $ACCUMULO_HOME does not exist! Accumulo imports will fail."
echo 'Please set $ACCUMULO_HOME to the root of your Accumulo installation.'
fi

(3)上述代码全部用“#”注释掉,如下所示:

## Moved to be a runtime check in sqoop.
#if [ ! -d "${HCAT_HOME}" ]; then
# echo "Warning: $HCAT_HOME does not exist! HCatalog jobs will fail."
# echo 'Please set $HCAT_HOME to the root of your HCatalog installation.'
#fi

#if [ ! -d "${ACCUMULO_HOME}" ]; then
# echo "Warning: $ACCUMULO_HOME does not exist! Accumulo imports will fail."
# echo 'Please set $ACCUMULO_HOME to the root of your Accumulo installation.'
#fi

(4)结果检验:

[Hadoop@master Tmp]$ sqoop help
2021-11-05 00:55:21,339 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
usage: sqoop COMMAND [ARGS]

Available commands:

codegen         Generate code to interact with database records
create-hive-table    Import a table definition into Hive
eval            Evaluate a SQL statement and display the results
export          Export an HDFS directory to a database table
help           List available commands
import             Import a table from a database to HDFS
import-all-tables     Import tables from a database to HDFS
import-mainframe     Import datasets from a mainframe server to HDFS
job          Work with saved jobs
list-databases      List available databases on a server
list-tables          List available tables in a database
merge           Merge results of incremental imports
metast         ore Run a standalone Sqoop metastore
version        Display version information

See 'sqoop help COMMAND' for information on a specific command.
[Hadoop@master Tmp]$ sqoop version
2021-11-05 00:55:33,567 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
Sqoop 1.4.7
git commit id 2328971411f57f0cb683dfb79d19d4d19d185dd8
Compiled by maugli on Thu Dec 21 15:59:58 STD 2017

3、问题剖析:

就是检测上述环境变量(${HCAT_HOME}和${ACCUMULO_HOME})是否存在,通常工具 HCatalog和Accumulo,要么没有安装,要么安装时改变了通常意义上(系统默认)的安装位置。笔者改变了上述安装位置,所以才导致上述报错。

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章