经过多次测试,如下方法可以成功
hadoop 0.20.2
调式脚本启动(运行如下脚本后,在eclipse调试同一个程序,并使用远程调试方式(可配置))
./bin/hddebug jar hadoop-0.20.2-examples.jar wordcount input/input output-di
1、先在win7下配置好hadoop一般可使用
2、然后把bin/hadoop 脚本copy一份,重新命名,叫hddebug
3、并在hddebug中增加一行
如下 即在 if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then增加
HADOOP_OPTS="$HADOOP_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=28888,server=y,suspend=y"
4、运行
./bin/hddebug jar hadoop-0.20.2-examples.jar wordcount input/input output-di
可看到 Listening for transport dt_socket at address: 28888
5、启动eclipse 调试wordcount这个代码
菜单,调试-设置成远程调试即可进行调试了详细如下
EclipseSocketGoITeyeHadoop.http://sigizmund.com/debugging-hadoop-applications-using-your-eclipse/
Well, it can be annoying – it can be awfully annoying, in fact, to debug Hadoop applications. But sometimes you need it, because logging doesn’t show anything, and you’ve tried anything but still cannot get under the Hadoop’s cover. In this case, do few simple steps.
1. Download and unpack Hadoop to your local machine.
2. Prepare small set of data you’re planning to run the test on
3. Check that you actually can run Hadoop locally, something like this (don’t forget to set $HADOOP_CLASSPATH first!):
bin/hdebug jar yourprogram.jar com.company.project.HadoopApp
tiny.txt ./out
4. Go to Hadoop’s directory, and copy file bin/hadoop to bin/hdebug
5. Now, we need to make Hadoop start in debug mode. What you should do is to add one line of text into the starting script:
Yes, here’s it. Copy it from here:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y
What does it say basically is an instruction to Java to start in debug mode, and wait for socket connection of the remote debugger on port 8001; execution should be suspended after the start until debugger is connected.
Now, go and start your grid application like you did in step 3, but now use bin/hdebug script we’ve created. If you’ve done everything correctly, program should output something like this:
Listening for transport dt_socket at address: 8001
and wait for debugger. So, let’s get it some debugger then! Fire up your Eclipse with your project (likely you have it opened already since you’re trying to debug something) and add new Debug configuration:
After you’ve set everything up, click “Apply” and close the window for now – probably, you’d want to set some breakpoints before starting the actual debugging. Go and do it, and then simply choose created debug configuration – and off you go! If everything worked properly, you should soon get a standard debugger window, with all the nice things Java can offer you. Hope it’ll help some of us in our difficult business of writing distributed grid-enabled applications!
Hive remote debugging
Figured out it is not very easy to debug the code, so here is a useful script we used to enable remote debugging in hive. We used Eclipse remote debugging with Hadoop 0.20.1 running in standalone method with Hive 0.5.0.
Please do remember to remove the extra lines that I had to add for formatting the script. Also, a better job can be done by using something like ‘for’ loop for getting all lib jars from Hadoop and Hive lib directory.
export HADOOP_HOME=/home/hadoop/hadoop-0.20.1
export HIVE_HOME=/home/hadoop/hive-0.5.0-bin
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export HIVE_LIB=$HIVE_HOME/lib
export HIVE_CLASSPATH=$HIVE_HOME/conf:$HIVE_LIB/antlr-runtime-3.0.1.jar:$HIVE_LIB/asm-3.1.jar:
$HIVE_LIB/commons-cli-2.0-SNAPSHOT.jar:$HIVE_LIB/commons-codec-1.3.jar:
$HIVE_LIB/commons-collections-3.2.1.jar:$HIVE_LIB/commons-lang-2.4.jar:
$HIVE_LIB/commons-logging-1.0.4.jar:$HIVE_LIB/commons-logging-api-1.0.4.jar:
$HIVE_LIB/datanucleus-core-1.1.2.jar:$HIVE_LIB/datanucleus-enhancer-1.1.2.jar:
$HIVE_LIB/datanucleus-rdbms-1.1.2.jar:$HIVE_LIB/derby.jar:$HIVE_LIB/hive-anttasks-0.5.0.jar:
$HIVE_LIB/hive-cli-0.5.0.jar:$HIVE_LIB/hive-common-0.5.0.jar:$HIVE_LIB/hive_contrib.jar:
$HIVE_LIB/hive-exec-0.5.0.jar:$HIVE_LIB/hive-hwi-0.5.0.jar:$HIVE_LIB/hive-jdbc-0.5.0.jar:
$HIVE_LIB/hive-metastore-0.5.0.jar:$HIVE_LIB/hive-serde-0.5.0.jar:
$HIVE_LIB/hive-service-0.5.0.jar:$HIVE_LIB/hive-shims-0.5.0.jar:
$HIVE_LIB/jdo2-api-2.3-SNAPSHOT.jar:$HIVE_LIB/jline-0.9.94.jar:
$HIVE_LIB/json.jar:$HIVE_LIB/junit-3.8.1.jar:$HIVE_LIB/libfb303.jar:
$HIVE_LIB/libthrift.jar:$HIVE_LIB/log4j-1.2.15.jar:
$HIVE_LIB/mysql-connector-java-5.0.0-bin.jar:$HIVE_LIB/stringtemplate-3.1b1.jar:
$HIVE_LIB/velocity-1.5.jar:
export HADOOP_LIB=$HADOOP_HOME/bin/../lib
export HADOOP_CLASSPATH=$HADOOP_HOME/bin/../conf:$JAVA_HOME/lib/tools.jar:
$HADOOP_HOME/bin/..:$HADOOP_HOME/bin/../hadoop-0.20.1-core.jar:
$HADOOP_LIB/commons-cli-1.2.jar:$HADOOP_LIB/commons-codec-1.3.jar:$HADOOP_LIB/commons-el-1.0.jar:
$HADOOP_LIB/commons-httpclient-3.0.1.jar:$HADOOP_LIB/commons-logging-1.0.4.jar:
$HADOOP_LIB/commons-logging-api-1.0.4.jar:$HADOOP_LIB/commons-net-1.4.1.jar:$HADOOP_LIB/core-3.1.1.jar:
$HADOOP_LIB/hsqldb-1.8.0.10.jar:$HADOOP_LIB/jasper-compiler-5.5.12.jar:
$HADOOP_LIB/jasper-runtime-5.5.12.jar:$HADOOP_LIB/jets3t-0.6.1.jar:$HADOOP_LIB/jetty-6.1.14.jar:
$HADOOP_LIB/jetty-util-6.1.14.jar:$HADOOP_LIB/junit-3.8.1.jar:$HADOOP_LIB/kfs-0.2.2.jar:
$HADOOP_LIB/log4j-1.2.15.jar:$HADOOP_LIB/oro-2.0.8.jar:$HADOOP_LIB/servlet-api-2.5-6.1.14.jar:
$HADOOP_LIB/slf4j-api-1.4.3.jar:$HADOOP_LIB/slf4j-log4j12-1.4.3.jar:$HADOOP_LIB/xmlenc-0.52.jar:
$HADOOP_LIB/jsp-2.1/jsp-2.1.jar:$HADOOP_LIB/jsp-2.1/jsp-api-2.1.jar:
export CLASSPATH=$HADOOP_CLASSPATH:$HIVE_CLASSPATH:$CLASSPATH
export DEBUG_INFO="-Xmx1000m -Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n"
$JAVA_HOME/bin/java $DEBUG_INFO -classpath $CLASSPATH -Dhadoop.log.dir=$HADOOP_HOME/bin/../logs
-Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=$HADOOP_HOME/bin/..
-Dhadoop.id.str= -Dhadoop.root.logger=INFO,console -Djava.library.path=$HADOOP_LIB/native/Linux-i386-32
-Dhadoop.policy.file=hadoop-policy.xml org.apache.hadoop.util.RunJar $HIVE_LIB/hive-service-0.5.0.jar
org.apache.hadoop.hive.service.HiveServer
$JAVA_HOME/bin/java -Xmx1000m $DEBUG_INFO -classpath $CLASSPATH -Dhadoop.log.dir=$HADOOP_HOME/bin/../logs
-Dhadoop.log.file=hadoop.log
-Dhadoop.home.dir=$HADOOP_HOME/bin/.. -Dhadoop.id.str= -Dhadoop.root.logger=INFO,console
-Djava.library.path=$HADOOP_LIB/native/Linux-i386-32 -Dhadoop.policy.file=hadoop-policy.xml
org.apache.hadoop.util.RunJar $HIVE_LIB/hive-cli-0.5.0.jar org.apache.hadoop.hive.cli.CliDriver
分享到:
相关推荐
“Fundamentals_in_debugging_nRF5x_systems - Hard Fault on nRF52.pdf”这一标题明确指出了文档的主要内容是关于nRF5x系统(特别是nRF52系列)的基本调试技术,并着重于解释硬故障(Hard Fault)的问题。...
- **ADB(Android Debug Bridge)**:连接PC与Android设备的桥梁,支持命令行调试,可以安装应用、发送命令、查看设备状态等。 - **JNI(Java Native Interface)调试**:对于包含C/C++代码的Android应用,需使用...
软件破解技术相关书籍_Debugging Applications。。
本教程旨在帮助所有阶段的新手掌握GDB的使用,从而实现更高效、更少挫败感的调试过程。 一、GDB简介 GDB是一个强大的开源调试工具,它允许程序员在程序运行时检查其内部状态,包括变量值、内存布局以及控制程序执行...
Debugging iOS Applications with IDA Pro, 最新版本,enjoy it
标题中的"dump_tlb.rar_Linux Debugging_dump"表明这是一个与Linux内核调试相关的压缩包,特别是针对TLB(Translation Lookaside Buffer)的转储工具。TLB是CPU中用于加速虚拟地址到物理地址转换的缓存,对性能至关...
Firebug的LiveView特性允许开发者实时查看页面布局的变化,而Console面板则可以显示所有JavaScript错误和警告,使得调试工作更为直观和高效。 #### 利用ASP.NET AJAX库中的调试辅助类 ASP.NET AJAX库包含了一些...
Ltrace主要用于追踪动态链接库中的函数调用,可以揭示程序内部对库函数的使用情况。它不仅能显示库函数的调用序列,还能显示系统调用,与Strace形成互补。Ltrace对于诊断由库函数引发的问题特别有用,如内存泄漏或...
Advanced_Apple_Debugging_&_Reverse_Engineering_v1.0 pdf 文档
windows程序调试 An_introduction_to_native_debugging
Advanced_Apple_Debugging_&_Reverse_Engineering_v2.0最新代码包
Advanced_Apple_Debugging_&_Reverse_Engineering_v1.0
理解编译过程、运行时环境以及异常处理机制,可以帮助我们更准确地定位代码中的错误。 代码规范和风格直接影响了代码的可读性和可维护性。良好的编程习惯可以减少出错的可能,使调试工作更加高效。例如,使用有意义...
通过DTrace,你可以编写脚本来监控特定的系统事件,如系统调用、内存分配、进程活动等,从而帮助诊断和优化应用程序。 2. **lldb**:lldb是LLVM项目的一部分,是一个强大的源代码级调试器,适用于多种编程语言,...
Debugging Mac OSX Applications with IDA Pro, 2020最新版本,非常详细,enjoy it!
这些高级策略通常需要深入理解操作系统和编程语言的底层实现,是高级调试人员必备的技能。 ### 7. 性能优化与分析 在软件开发中,性能优化是不可或缺的一环。本书也涉及了性能分析工具的使用,以及如何通过调试...
GS2011M and GS2100M ultra-low power 802.11 b/g/n WiFi on-board modules and debugging Serial-to-WiFi and Temperature and Light Sensor applications using IAR embedded workbench.
掌握内核调试方法,无疑是事半功被之举。调试是基本功之一