Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To do so, the Java platform allows developer to attach a debugger to a running JVM.

...

Passing the remote debugging JVM options 

The JVM you wish to attach the debugger to has to be started with a certain set of parameters for the remote debugging capability to be enabled.In particular, you should edit the startup script you use (either bin/yarn-session.sh for YARN or bin/flink-daemon.sh for the standalone scheduler) adding the following parameters to the java command:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

The command specifies to open the the 5005 port  port (make sure your firewall poses no problem) and to suspend the process until a debugger is attached to the process. If you wish to allow remote debugging without having to attach a debugger before startup, simply set suspend=n.

Passing the JVM options via env.java.opts

In order to pass the remote debugging options to the JVM you can use Flink's env.java.opts configuration parameter. Simply set in the flink-conf.yaml the following line before starting your Flink cluster.

env.java.opts: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

Passing the JVM options as a dynamic property

When starting Flink in YARN mode via the bin/yarn-session.sh script you can also provide the JVM options via a dynamic property. Simply add the following option to your yarn-session.sh command.

bin/yarn-session.sh -Denv.java.opts="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

Editing the start-up scripts

Alternatively, you can edit the startup scripts bin/yarn-session.sh (for YARN) or bin/flink-daemon.sh (for standalone cluster) to include the JVM options.

Attach a remote debugger with IntelliJ IDEA

...