RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
sqoop中query\$CONDITIONSHUE执行失败怎么办

这篇文章给大家介绍sqoop中query \$CONDITIONS HUE执行失败怎么办,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

成都创新互联公司2013年至今,先为利州等服务建站,利州等地企业,进行企业商务咨询服务。为利州企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

1. HUE sqoop命令框中直接输入:

sqoop-import --connect jdbc:MySQL://ip地址:端口/数据库 --username 用户名 --password 密码 --query select * from 表名 where 1=1 and \$CONDITIONS --split-by id --hive-table hive表 --target-dir /apps/hive/warehouse/mydb.db/product/dt=${date} --hive-partition-key dt --hive-partition-value ${date} --hive-import --driver com.mysql.jdbc.Driver

运行会提示报错,是因为SQL语句被解析成sqoop参数

2784 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Error parsing arguments for import:
2016-09-11 15:21:46,485 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(304)) - Error parsing arguments for import:
2785 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Unrecognized argument: *
2016-09-11 15:21:46,486 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(307)) - Unrecognized argument: *
2785 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Unrecognized argument: from
2016-09-11 15:21:46,486 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(307)) - Unrecognized argument: from
2785 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Unrecognized argument: product
2016-09-11 15:21:46,486 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(307)) - Unrecognized argument: p_product
2785 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Unrecognized argument: where
2016-09-11 15:21:46,486 ERROR [main] tool.BaseSqoopTool (BaseSqoopTool.java:hasUnrecognizedArgs(307)) - Unrecognized argument: where
2785 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool  - Unrecognized argument: $CONDITIONS

2. 解决方案: 最好采用参数化的方式


   
   
        Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]
   

   
       
            ${jobTracker}
            ${nameNode}
              import
              --connect
              "jdbc:mysql://IP地址:端口/数据库"
              --username
              "用户名"
              --password
              "密码"
              --query
              select * from product where $CONDITIONS    ## 注意:这个地方没有反斜杠(\)
              --split-by
              "id"
              --hive-table
              "HIVE表名"
              --target-dir
              "/apps/hive/warehouse/mydb.db/product/dt=${date}"
              --hive-partition-key
              "dt"
              --hive-partition-value
              "${date}"
              --hive-import
              --driver
              "com.mysql.jdbc.Driver"
       

       
       
   

   

关于sqoop中query \$CONDITIONS HUE执行失败怎么办就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


当前标题:sqoop中query\$CONDITIONSHUE执行失败怎么办
标题网址:http://cqwzjz.cn/article/phdesh.html