- Spark Streaming If you run in local mode, the log log is very clear.
- 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)
- 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