sqoop import --connect jdbc:mysql://127.0.0.1:3306/test --username root --password root --table users -export-dir /user/hadoop/employees -m 1 Warning: /usr/local/sqoop/../hcatalog does not exist! HCatalog jobs will fail. Please set $HCAT_HOME to the root of your HCatalog installation. Warning: /usr/local/sqoop/../accumulo does not exist! Accumulo imports will fail. Please set $ACCUMULO_HOME to the root of your Accumulo installation. Warning: /usr/local/sqoop/../zookeeper does not exist! Accumulo imports will fail. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation. 2023-05-23 06:14:51,641 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6 2023-05-23 06:14:51,697 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. 2023-05-23 06:14:51,697 ERROR tool.BaseSqoopTool: Error parsing arguments for import: 2023-05-23 06:14:51,697 ERROR tool.BaseSqoopTool: Unrecognized argument: /user/hadoop/employees 2023-05-23 06:14:51,697 ERROR tool.BaseSqoopTool: Unrecognized argument: -m 2023-05-23 06:14:51,697 ERROR tool.BaseSqoopTool: Unrecognized argument: 1 Try --help for usage instructions.
时间: 2023-12-03 17:44:55 浏览: 400
sqoop-1.4.6-cdh5.14.2.tar系列安装包
这段代码是使用Sqoop从MySQL数据库中导入数据到Hadoop集群中的HDFS中,但是出现了一些错误。其中包括:
1. HCatalog、Accumulo和Zookeeper的路径未设置,可能会影响后续操作。
2. 密码明文传输,建议使用-P参数。
3. 导入参数错误,未识别参数/user/hadoop/employees、-m和1。
你需要检查以下几个方面:
1. 检查Hadoop集群中是否安装了HCatalog、Accumulo和Zookeeper,并设置对应的环境变量。
2. 使用-P参数替代密码明文传输。
3. 导入参数有误,应该使用--export-dir参数指定需要导入的目录,使用-m参数指定导入任务的并发度。
以下是修改后的代码:
```
sqoop import --connect jdbc:mysql://127.0.0.1:3306/test --username root -P --table users --export-dir /user/hadoop/employees --num-mappers 1
```
阅读全文