Hadoop JMX

1.修改配置开发JMX端口

假设hadoop(hadoop-0.20.0)安装目录用$hadoop_home表示。修改$hadoop_home/conf/hadoop_env.sh配置文件,修改之处如下:

# Extra Java runtime options.  Empty by default.
export HADOOP_OPTS="-Djava.rmi.server.hostname=10.132.30.46 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.access.file=$HADOOP_CONF_DIR\jmxremote.access \
-Dcom.sun.management.jmxremote.password.file=$HADOOP_CONF_DIR\jmxremote.password"

# Command specific options appended to HADOOP_OPTS when specified
export HADOOP_NAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_NAMENODE_OPTS -Dcom.sun.management.jmxremote.port=8004"
export HADOOP_SECONDARYNAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_SECONDARYNAMENODE_OPTS -Dcom.sun.management.jmxremote.port=8005"
export HADOOP_DATANODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_DATANODE_OPTS -Dcom.sun.management.jmxremote.port=8006"
export HADOOP_BALANCER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_BALANCER_OPTS -Dcom.sun.management.jmxremote.port=8007"
export HADOOP_JOBTRACKER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_JOBTRACKER_OPTS -Dcom.sun.management.jmxremote.port=8008"
export HADOOP_TASKTRACKER_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8009"
 

2.执行$hadoop_home/bin/stop-all.sh和start-all.sh,进行重启。

3. 通过jconsole连接JMX端口,进行测试。

相关推荐