高手的存在,就是让服务10亿人的时候,你感觉只是为你一个人服务......

jvisualvm JMX 监控wildfly8.1

目录
  1. 1. 修改module.xml
  2. 2. 修改standalone.xml
  3. 3. 添加jboss用户
  4. 4. 重启jboss
  5. 5. 启动jvisualvm

jvisualvm JMX 监控wildfly8.1相关配置.


修改module.xml

/opt/wildfly/modules/system/layers/base/org/wildfly/extension/io/main/module.xml

加入:

1
2
3
<module name="org.jboss.remoting" export="true"/>
<module name="org.jboss.remoting-jmx" export="true"/>
<module name="javax.api"/>

修改standalone.xml

确定是domain还是standalone运行,我这边是standalone,修改standalone.xml。如果是domain,修改domain.xml

/opt/wildfly/standalone/configuration/ standalone.xml

remoting-connector 修改为false

1
2
3
4
5
<subsystem xmlns="urn:jboss:domain:jmx:1.3">
<expose-resolved-model/>
<expose-expression-model/>
<remoting-connector use-management-endpoint="false"/>
</subsystem>

添加jboss用户

添加用户 appuser, 密码 SecR3t

到服务器上,执行下面的语句即可:

1
2
3
4
5
/opt/jboss/bin/add-user.sh -a -u appuser -p SecR3t  

/opt/wildfly/bin/jboss-cli.sh --connect --commands="/core-service=management/access=authorization/role-mapping=Administrator:add"

/opt/wildfly/bin/jboss-cli.sh --connect --commands=" /core-service=management/access=authorization/role-mapping=Administrator/include=appuser:add(name=appuser,type=USER)"

重启jboss

/opt/wildfly/bin/stop.sh && /opt/wildfly/bin/start.sh

启动jvisualvm

先将jboss的jboss-client.jar 拷贝到本地JAVA_HOME/lib下面

执行:jvisualvm -cp:a “C:\Program Files (x86)\Java\jdk1.7.0_10\lib\jboss-client.jar”

添加jmx连接,填写:service:jmx:http-remoting-jmx://10.244.119.229:8080

Alt text

监控完成:

Alt text