简体   繁体   English

使用Java 8在Windows上调试Spark进程

[英]Debug spark process on windows with Java 8

I can run spark on windows with commands in cmd.exe: 我可以使用cmd.exe中的命令在Windows上运行spark:

set CLASS=org.apache.spark.deploy.SparkSubmit
%SPARK_HOME%\bin\spark-class2.cmd %CLASS%  --class "com.sel2in.TstFac" --master local[4]  target\scala-2.11\theApp_2.11-1.0.jar

In spark-class2.cmd want to add remote debugging options: 在spark-class2.cmd中要添加远程调试选项:

set JOPTS=
set JOPTS=-agentlib:jdwp=transport=dt_socket,server=y,address=8001,suspend=y,timeout=30
REM set JOPTS=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y 
REM set JOPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,timeout=3,address=4002

But the settings don't work. 但是设置不起作用。 It seems one program builds the actual command to build. 似乎有一个程序可以构建实际要构建的命令。 Anyone been able to get the right set options in so can run the spark command in debug mode, attach to it like you would any Java process ? 任何人都能够获得正确的set选项,因此可以在调试模式下运行spark命令,像执行任何Java进程一样将其附加到该命令上吗? (local single spark mode) (本地单火花模式)

Last two lines are helpful. 最后两行很有帮助。

del %LAUNCHER_OUTPUT%
%SPARK_CMD%

So the command is written to a file. 因此,该命令已写入文件。 Then that file is read, joined and run!. 然后读取该文件,将其加入并运行! Rem out the 2nd lsat line or add an echo and pause like 退出第二条lsat行,或添加回显和暂停,例如

echo %LAUNCHER_OUTPUT%
pause
REM del %LAUNCHER_OUTPUT%
%SPARK_CMD%

OR 要么

del %LAUNCHER_OUTPUT%
echo  %SPARK_CMD%
pause
%SPARK_CMD%

Then edit the read command to add debug options as you would to other java program. 然后编辑read命令,以将调试选项添加到其他Java程序中。 Then attach to it from eclipse. 然后从月食附着到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM