[root@Hadoop01 bin]# ./sqoop import \ > --connect jdbc:mysql: /hadoop01:3306/gmall?characterEncoding=utf-8 Warning: /usr/local/sqoop/../hbase does not exist! HBase imports will fail. Please set $HBASE_HOME to the root of your HBase installation. Warning: /usr/local/sqoop/../zookeeper does not exist! Accumulo imports will fail. Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation. 23/06/10 00:28:21 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7 23/06/10 00:28:21 ERROR tool.BaseSqoopTool: Error parsing arguments for import: 23/06/10 00:28:21 ERROR tool.BaseSqoopTool: Unrecognized argument: /hadoop01:3306/gmall?characterEncoding=utf-8 Try --help for usage instructions. [root@Hadoop01 bin]# \ > --username root \ > --password 123123 \ > --query "select > od.id,order_id,user_id,sku_id,sku_num,od.create_time from > order_detail od join order_info oi on od.order_id = oi.id where > DATE_FORMAT(od.create_time,'%Y-%m-%d')='2023-05-25' and > \$CONDITIONS" -m 1 \ > --target-dir /gmall1_data/order_detail/data/2023-05-25 \ > --fields-terminated-by "," \ > --lines-terminated-by "\n" \ > --null-string '\\N' \ > --null-non-string '\\N'; -bash: --username: command not found [root@Hadoop01 bin]#
时间: 2024-03-22 21:42:03 浏览: 79
从你的命令行输出来看,你似乎正在尝试使用Sqoop从MySQL中导入数据到Hadoop。但是,你的命令格式似乎有一些问题。你在第一行中指定了连接字符串,但是在命令的后面没有指定数据表名称。另外,你在命令的后面似乎使用了“\”字符,但是没有明确指定这是一个多行命令。这可能导致命令无法正确解析。最后,你在命令行的最后一行中指定了多个参数,但是使用了分号将它们隔开,这也可能导致命令无法正确解析。
你可以尝试使用以下命令来导入数据,它可能会更容易理解和执行:
```
sqoop import \
--connect jdbc:mysql://hadoop01:3306/gmall \
--username root \
--password 123123 \
--query "select od.id,order_id,user_id,sku_id,sku_num,od.create_time from order_detail od join order_info oi on od.order_id = oi.id where DATE_FORMAT(od.create_time,'%Y-%m-%d')='2023-05-25' and \$CONDITIONS" \
-m 1 \
--target-dir /gmall1_data/order_detail/data/2023-05-25 \
--fields-terminated-by "," \
--lines-terminated-by "\n" \
--null-string '\\N' \
--null-non-string '\\N'
```
请确保在命令中使用正确的数据库连接字符串和用户名/密码,并根据需要更改查询条件和目标目录。
阅读全文