[ 
https://issues.apache.org/jira/browse/HBASE-10289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13978028#comment-13978028
 ] 

Qiang Tian commented on HBASE-10289:
------------------------------------

Hi  Demai Ni, stack,
I took a look. below is the details.

the problem is JMX created 2 additional random ports besides the port specified 
by "com.sun.management.jmxremote.port". 

One port is RMI server port, the other is used by Java Attach API for local 
attach purpose(see more details below)

it looks it has been the case for long time. prior effort focused on 
customizing the RMI server port, because the port is used by client -- when 
firewall is configured, client just cannot connect to JMX, for example:
http://olegz.wordpress.com/2009/03/23/jmx-connectivity-through-the-firewall/

there is some artifcat to address it as well, e.g. :
http://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JMX_Remote_Lifecycle_Listener_-_org.apache.catalina.mbeans.JmxRemoteLifecycleListener

both registry port(rmiRegistryPortPlatform) and RMI server 
port(rmiServerPortPlatform) can be configured, and authentication is supported.

Sun JDK realized this problem, the RMI server port can be configured via 
"com.sun.management.jmxremote.rmi.port", since JDK7u4.

then what about the local attach port, which is also random?

According to 
http://stackoverflow.com/questions/20884353/why-java-opens-3-ports-when-jmx-is-configured,
 this feature can be disabled by "-XX:+DisableAttachMechanism" (there is no 
clear description about it in official link 
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html), but 
the guy tested it just does not work, and recently he opened defect against 
java: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8035404

> Avoid random port usage by default JMX Server. Create Custome JMX server
> ------------------------------------------------------------------------
>
>                 Key: HBASE-10289
>                 URL: https://issues.apache.org/jira/browse/HBASE-10289
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: nijel
>            Priority: Minor
>             Fix For: 0.99.0
>
>         Attachments: HBASE-10289-v4.patch, HBASE-10289.patch, 
> HBASE-10289_1.patch, HBASE-10289_2.patch, HBASE-10289_3.patch
>
>
> If we enable JMX MBean server for HMaster or Region server  through VM 
> arguments, the process will use one random which we cannot configure.
> This can be a problem if that random port is configured for some other 
> service.
> This issue can be avoided by supporting  a custom JMX Server.
> The ports can be configured. If there is no ports configured, it will 
> continue the same way as now.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to