Spark Streaming Debugging Tips

Source: Internet
Author: User
Tags iterable

    1. Spark Streaming If you run in local mode, the log log is very clear.
    2. If the log log is running in yarn mode, driver logs can be seen through the Reource manager log. But executor's log can not see, we often error occurs in executor, such as a typical error: If we connect hbase to access data, we will initialize the connection in the driver, the lack of ignored excutors, resulting in a program error. If your code has a try Cache,executor error does not affect driver run, but the result is wrong. We need to check the executor log: Since executor runs in yarn mode, we view the logs from the local containner. CDH version of Yarn container log again under the following path:

[Email protected] ~]# ll/var/log/hadoop-yarn/container/application_1429701572510_0022/container_1429701572510_ 0022_01_000002/
Total dosage 932
-rw-r–r–1 yarn yarn 339015 April 11:53 stderr
-rw-r–r–1 yarn yarn 613851 April 11:53 stdout (we output the log)

    1. HBase Initialize the connection, the official website also has the description, in the executor to initialize:
Userlog.Foreachrdd (NewFunction2<Javapairrdd<String, iterable<String>>, Time,Void>() {@Override Public VoidCall (Javapairrdd<String, iterable<String>>Stringiterablejavapairrdd, Time time) throws Exception {if(!Stringiterablejavapairrdd.Partitions ().IsEmpty ()) {Stringiterablejavapairrdd.Foreachpartition (NewVoidfunction<Iterator<Tuple2<String, iterable<String>>>>() {@Override Public voidCall (Iterator<Tuple2<String, iterable<String>>>Tuple2iterator) throws Exception {//Initialize HBase connectionHbaseconnectionfactory.Init (); while(Tuple2iterator.Hasnext ()) {//Specific logic code}            });}return NULL; }});

Spark Streaming Debugging Tips

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.