• Oozie 集成 Sqoop


    1) modify yarn to avoid workflow hang
    $ cd ~/work/hadoop/etc/hadoop
    $ diff -u yarn-site.xml.orig yarn-site.xml

    1. --- yarn-site.xml.orig 2022-06-21 14:44:21.000000000 +0800
    2. +++ yarn-site.xml 2022-06-29 16:03:34.000000000 +0800
    3. @@ -29,4 +29,8 @@
    4. <name>yarn.log-aggregation.retain-seconds</name>
    5. <value>604800</value>
    6. </property>
    7. + <property>
    8. + <name>yarn.resourcemanager.scheduler.class</name>
    9. + <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>
    10. + </property>
    11. </configuration>

    2) prepare the case
    $ cd ~/work/oozie-5.2.1
    $ tree oozie/apps/sqoop_import

    1. oozie/apps/sqoop_import
    2. ├── job.properties
    3. ├── lib
    4. │   └── mysql-connector-java-8.0.28.jar
    5. └── workflow.xm

    $ cat oozie/apps/sqoop_import/job.properties

    1. nameNode=hdfs://localhost:9000
    2. resourceManager=localhost:8032
    3. queueName=default
    4. oozieRoot=user/${user.name}/oozie
    5. oozie.use.system.libpath=true
    6. oozie.wf.application.path=${nameNode}/${oozieRoot}/apps/sqoop_import
    7. outputDir=data/sqoop_import/output

    $ cat oozie/apps/sqoop_import/workflow.xml

    1. <workflow-app xmlns="uri:oozie:workflow:1.0" name="sqoop-wf">
    2. <start to="sqoop-node"/>
    3. <action name="sqoop-node">
    4. <sqoop xmlns="uri:oozie:sqoop-action:1.0">
    5. <resource-manager>${resourceManager}</resource-manager>
    6. <name-node>${nameNode}</name-node>
    7. <prepare>
    8. <delete path="${nameNode}/${oozieRoot}/${outputDir}"/>
    9. </prepare>
    10. <configuration>
    11. <property>
    12. <name>mapred.job.queue.name</name>
    13. <value>${queueName}</value>
    14. </property>
    15. </configuration>
    16. <arg>import</arg>
    17. <arg>--connect</arg>
    18. <arg>jdbc:mysql://localhost:3306/manga</arg>
    19. <arg>--username</arg>
    20. <arg>manga</arg>
    21. <arg>--password</arg>
    22. <arg>manga</arg>
    23. <arg>--table</arg>
    24. <arg>fruit</arg>
    25. <arg>--target-dir</arg>
    26. <arg>/${oozieRoot}/${outputDir}</arg>
    27. <arg>-m</arg>
    28. <arg>1</arg>
    29. </sqoop>
    30. <ok to="end"/>
    31. <error to="fail"/>
    32. </action>
    33. <kill name="fail">
    34. <message>Sqoop failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    35. </kill>
    36. <end name="end"/>
    37. </workflow-app>

    3) upload to hdfs
    $ hdfs dfs -put oozie/apps/sqoop_import oozie/apps/

    4) run and check
    $ bin/oozie job -config oozie/apps/sqoop_import/job.properties -run
    job: 0000000-220629212524491-oozie-sun_-W
    ~/work/oozie-5.2.1$ bin/oozie job -info 0000000-220629212524491-oozie-sun_-W  

    1. Job ID : 0000000-220629212524491-oozie-sun_-W
    2. ------------------------------------------------------------------------------------------------------------------------------------
    3. Workflow Name : sqoop-wf
    4. App Path : hdfs://localhost:9000/user/sun_xo/oozie/apps/sqoop_import
    5. Status : SUCCEEDED
    6. Run : 0
    7. User : sun_xo
    8. Group : -
    9. Created : 2022-06-29 13:27 GMT
    10. Started : 2022-06-29 13:27 GMT
    11. Last Modified : 2022-06-29 13:27 GMT
    12. Ended : 2022-06-29 13:27 GMT
    13. CoordAction ID: -
    14. Actions
    15. ------------------------------------------------------------------------------------------------------------------------------------
    16. ID Status Ext ID Ext Status Err Code
    17. ------------------------------------------------------------------------------------------------------------------------------------
    18. 0000000-220629212524491-oozie-sun_-W@:start: OK - OK -
    19. ------------------------------------------------------------------------------------------------------------------------------------
    20. 0000000-220629212524491-oozie-sun_-W@sqoop-node OK application_1656509094029_0001SUCCEEDED -
    21. ------------------------------------------------------------------------------------------------------------------------------------
    22. 0000000-220629212524491-oozie-sun_-W@end OK - OK -
    23. ------------------------------------------------------------------------------------------------------------------------------------

    Note: Oozie application logs can be found under hdfs://localhost:9000/tmp/${user.name}/logs/,  which is very useful in troubleshooting

    1. ...
    2. Oozie Launcher Application Master configuration
    3. ===============================================
    4. Workflow job id : 0000000-220629212524491-oozie-sun_-W
    5. Workflow action id: 0000000-220629212524491-oozie-sun_-W@sqoop-node
    6. ...
  • 相关阅读:
    在Winform系统开发中,对表格列表中的内容进行分组展示
    2022杭电多校第一场
    不同类型的变量与零究竟是如何比较
    Seata TCC、Saga、XA模式初识
    纯js实现录屏并保存视频到本地的尝试
    怎么在树莓派上搭建WordPress博客网站,并发布到外网可访问?
    ARMv7系统寄存器
    火柴拼正方形(回溯法实现)
    基于FPGA的OV7670摄像头实时检测
    HDLBits-Edgecapture
  • 原文地址:https://blog.csdn.net/sun_xo/article/details/125529360