Hadoop分布式远程Debug方式

1、进入目录修改配置文件

cd /cloud/hadoop-2.2.0/etc/hadoop
vim hadoop-env.sh
2、加入内容(文本最后):
#远程调试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"

注意其他可配置的参数:

hadoop远程debug配置
在/cloud/hadoop-2.2.0/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"
#远程调试ResourceManager
export YARN_RESOURCEMANAGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=10888,server=y,suspend=y"
#远程调试NodeManager
export YARN_NODEMANAGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=11888,server=y,suspend=y"

3、退出到/root/cloud/hadoop-2.2.0/sbin目录下
A、cd sbin/ 目录下执行启动

B、启动方式:
(1)NameNode的启动命令
./hadoop-daemon.sh start namenode
成功返回:
starting namenode, logging to /root/cloud/hadoop-2.2.0/logs/hadoop-root-namenode-northbigpenguin.out
Listening for transport dt_socket at address: 8888

(2)DataNode的启动方式
./hadoop-daemon.sh start datanode
成功返回:
starting datanode, logging to /root/cloud/hadoop-2.2.0/logs/hadoop-root-datanode-northbigpenguin.out
Listening for transport dt_socket at address: 9888
C、关闭方式:
./hadoop-daemon.sh stop namenode
./hadoop-daemon.sh stop datanode

(1)设置断点 ,双击行号位置

Hadoop分布式远程Debug方式

(2)选择项目,找到需要调试的类,然后选择debug----->Debug Congratulation

Hadoop分布式远程Debug方式

Hadoop分布式远程Debug方式

(3)进入如图位置,然后按照如图的参数进行配置,然后选择Apply----->Debug,就可以开始Debug了

Hadoop分布式远程Debug方式

上一篇:[原创]java WEB学习笔记61:Struts2学习之路--通用标签 property,uri,param,set,push,if-else,itertor,sort,date,a标签等


下一篇:Struts2--HelloWord