在hadoop-env.sh中添加

    1. #hadoop远程debug配置
    2. #远程调试NameNode
    3. export HADOOP_NAMENODE_OPTS="-agentlib:jdwp=transport=dt_socket,address=4488,server=y,suspend=y"
    4. #远程调试DataNode
    5. export HADOOP_DATANODE_OPTS="-agentlib:jdwp=transport=dt_socket,address=9888,server=y,suspend=y"
    6. #远程调试ResourceManager
    7. export YARN_RESOURCEMANAGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=10888,server=y,suspend=y"
    8. #远程调试NodeManager
    9. export YARN_NODEMANAGER_OPTS="-agentlib:jdwp=transport=dt_socket,address=11888,server=y,suspend=y"

    CDH集群要加到JVM启动参数里
    具体细节在如下链接
    https://silvermissile.github.io/2020/07/23/%E8%BF%9C%E7%A8%8B%E8%B0%83%E8%AF%95CDH%E7%9A%84NameNode/