Crontab+shell Job Flow scheduling __hadoop

Source: Internet
Author: User

In the previous article, we had a simple reference to the pseudo code of the shell or Python dispatch hive, and today we are enriching the pseudocode

http://blog.csdn.net/haohaixingyun/article/details/51821444

Note that in the actual production environment, you may deploy some mature job flow scheduling engine Oozie or Azkaban, and more detailed information please check

Today we have three shell scripts for code, the Code has reference online teaching materials


1. crontab

*/10 * * * * root/opt/main.sh

2,mapreduce_job.sh Script

cmd = "Hadoop jar Example.jar xxx-d ..."

$cmd

Code=$?

while[$code!=0];d o

echo "Run job failed, run submit ..."

$cmd

Done

3,hive_job.sh Script

cmd = "hive-e \" use MyDatabase. ALTER TABLE T add if not EXISTS partition (pt = "20160719") location '/gr/data/20160719;

Select COUNT (*) from t where pt = ' 20160719 '

$cmd

Code=$?

While [$code!=0];d o

echo "Run job failed, run submit ..."

$cmd

Done

4, main.sh to establish a dependency relationship

SH mapreduce_job.sh

SH hive_job.sh



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.