hadoop要实现远程调试需要在配置文件添加参数
【1】添加参数,$HADOOP_HOME/etc/hadoop/hadoop-env.sh文件
#远程调试namenode
export HADOOP_NAMENODE_OPTS="-agentlib:jdwp=transport=dt_socket,address=8888,server=y,suspend=y"
#远程调试datanode
export HADOOP_DATANODE_OPTS="-agentlib:jdwp=transport=dt_socket,address=9888,server=y,suspend=y"
#远程调试RM
export YARN_RESOURCEMANAGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=10888,server=y,suspend=y"
#远程调试NM
export YARN_NODEMANAGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=10888,server=y,suspend=y"
【2】启动hadoop
start-all.sh
【3】调试namenode
步骤:
ctrl + shift + t > 输入namenode > 选择对应的jar > 搜索main方法 > main方法打断点 >
右击main > debug as > debug config > Remote Java Application > 配置host,配置Port > debug
图例: