You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mlange <ml...@anwb.nl> on 2016/08/17 18:17:31 UTC

What is the proper way to configure multiple brokers on the same machine in regard to jmx

For various purposes, I wish to define various brokers on the same machine.
For example: some queues require ordering of data, and thus use the
replicatedLevelDb as persistence adapter, others don't even need persistence
or ordering and can use only memory in order to provide faster throughput,
etc...

Other than described in the page about jmx, just using the "default"
useJmx="true" parameter in the broker definition, does not change a thing.
("default" is quoted, as according to the docs this parameter is always in
effect)

So, I tried fiddling around, and got thus far:

In ACTIVEMQ_HOME/bin/env  I had to add / uncomment these lines (for now I
won't use authentication; might be added in a later stage, but first want to
see it "just work")

ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START
-Dcom.sun.management.jmxremote.port=11099 "
ACTIVEMQ_SUNJMX_START="$ACTIEVMQ_SUNJMX_START
-Dcom.sun.management.jmx.authenticate=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START
-Dcom.sun.management.jmxremote.ssl=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START
-Dcom.sun.management.jmxremote"

in the broker definition (activemq.xml) I had to change this part:
        <managementContext>
            <managementContext createConnector="true"
                useMBeanServer="true"
                jmxDomainName="broker1"
                createMBeanServer="true"
                connectorHost="localhost"
                connectorPort="1099"
                />
        </managementContext>

This seems to work for the first broker. When starting the second broker,
which has a few different options:
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START
-Dcom.sun.management.jmxremote.port=12099 "
ACTIVEMQ_SUNJMX_START="$ACTIEVMQ_SUNJMX_START
-Dcom.sun.management.jmx.authenticate=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START
-Dcom.sun.management.jmxremote.ssl=false"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START
-Dcom.sun.management.jmxremote"

and a managementContext like this:
        <managementContext>
            <managementContext 
                createConnector="true"
                useMBeanServer="true"
                jmxDomainName="broker2"
                createMBeanServer="true"
                connectorHost="localhost"
                connectorPort="1099"
                />
        </managementContext>

I get the exception that a server is already active (which is true, it's
started by the frist broker)
Failed to start JMX connector Cannot bind to URL
[rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException:
jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]. Will
restart man
agement to re-create JMX connector, trying to remedy this issue. |
org.apache.activemq.broker.jmx.ManagementContext | JMX connector

I had hoped that the second broker would try to find an active mbean service
and register at it, or otherwise starts one. (Same for the first broker); 

Is this possible (or are my wishes actually desirable) at all, or not? And
how to get this configured properly?






--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-proper-way-to-configure-multiple-brokers-on-the-same-machine-in-regard-to-jmx-tp4715589.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by mlange <ml...@anwb.nl>.
I guess that is what I will do indeed; In normal operations time I'll hardly
use jconsole itself; but will have some centralized tools or just simply use
jolokia; Thanks for the advise given!



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-proper-way-to-configure-multiple-brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715652.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by Tim Bain <tb...@alumni.duke.edu>.
You can attach JConsole to multiple JVMs (ActiveMQ or otherwise) at once,
which might be what you want.  It might even be better, because you can
scroll to equivalent parts of both trees and see them side-by-side.

On Aug 18, 2016 8:06 AM, "mlange" <ml...@anwb.nl> wrote:

> It was a human (mine) error; I modified it... apologies if I had you
> thinking
> it was a typo in the default.
> I had been fiddling around... and have been even more:
>
> I now realized a few things; The bind error I had earlier, which caused me
> to think the problem was the port, actually was not the port, but the path
> "/jmxrmi"; When I changed that on the second broker it could bind.
>
> But then the other (logical) problem arose when I restarted the first
> broker... then the jmx for broker2 could no longer be found... besides,
> both
> brokers would never end up in the same jmx connection (e.g. jconsole);
>
> The thing I was trying to accomplish was getting one jmx mbean server to
> "rule" all brokers (even remote ones) so I would have a single point of
> management (restarting, memory usage, cpu utilization, etc) I'm getting to
> the conclusion this will not be possible... although it would really be
> cool
> to have such a thing :-)
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/What-is-the-proper-way-to-configure-multiple-
> brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715636.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by mlange <ml...@anwb.nl>.
It was a human (mine) error; I modified it... apologies if I had you thinking
it was a typo in the default.
I had been fiddling around... and have been even more:

I now realized a few things; The bind error I had earlier, which caused me
to think the problem was the port, actually was not the port, but the path
"/jmxrmi"; When I changed that on the second broker it could bind.

But then the other (logical) problem arose when I restarted the first
broker... then the jmx for broker2 could no longer be found... besides, both
brokers would never end up in the same jmx connection (e.g. jconsole); 

The thing I was trying to accomplish was getting one jmx mbean server to
"rule" all brokers (even remote ones) so I would have a single point of
management (restarting, memory usage, cpu utilization, etc) I'm getting to
the conclusion this will not be possible... although it would really be cool
to have such a thing :-) 




--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-proper-way-to-configure-multiple-brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715636.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by Tim Bain <tb...@alumni.duke.edu>.
Here's the current version of that file in GitHub:
https://github.com/apache/activemq/blob/master/assembly/src/release/bin/env

I see different lines than you do, even though you're using 5.14.0 which
was just released.  Is there any chance you're not actually using 5.14.0?

Tim

On Aug 18, 2016 2:12 AM, "mlange" <ml...@anwb.nl> wrote:

>
> Tim,
>
> Your comment got me thinking why port 1099 was getting used rather than
> 11099 (and 12099); so I checked my java process and it's parameters: (ps
> -ef
> | grep java); I noticed the parameter telling the port was not in it.
> There's a stupid typo in the "env" files:
> ACTIVEMQ_SUNJMX_START="$ACTIEVMQ_SUNJMX_START
> -Dcom.sun.management.jmx.authenticate=false"
>
> So, fixed that; And now the broker won't start:
>
> Error: Password file not found:
> /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.111.x86_64/jre/
> lib/management/jmxremote.password
>
> This one is a bit strange; I think I said to make an "unsafe,
> unauthenticate
> mbean server"; but at least that problem is out of the way now. Now to get
> both brokers connecting to the same MBean Server (or start one, if none is
> available)... to be continued.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/What-is-the-proper-way-to-configure-multiple-
> brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715625.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by mlange <ml...@anwb.nl>.
 
Tim,

Your comment got me thinking why port 1099 was getting used rather than
11099 (and 12099); so I checked my java process and it's parameters: (ps -ef
| grep java); I noticed the parameter telling the port was not in it.
There's a stupid typo in the "env" files:
ACTIVEMQ_SUNJMX_START="$ACTIEVMQ_SUNJMX_START
-Dcom.sun.management.jmx.authenticate=false"

So, fixed that; And now the broker won't start:

Error: Password file not found:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.111.x86_64/jre/lib/management/jmxremote.password

This one is a bit strange; I think I said to make an "unsafe, unauthenticate
mbean server"; but at least that problem is out of the way now. Now to get
both brokers connecting to the same MBean Server (or start one, if none is
available)... to be continued.



--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-proper-way-to-configure-multiple-brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715625.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by mlange <ml...@anwb.nl>.
For no obvious reason, actually...

At first I did not have these parameters, neither on broker1 nor on broker2;
however, upon starting broker1 first, I noticed this line:

JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi |
org.apache.activemq.broker.jmx.ManagementContext | JMX connector

So, I assumed (I know, assumption is the mother of all ehrm... ) there would
be one "overall" process that would kind of redirect connections to the
"real" process, acting like a kind of proxy so to say.

As you can see, broker1 has the same configuration, with port 1099 whereas
port 11099 is the port in the environment file;
I'll remove both parameters in the activemq.xml 

So, broker1 now has this managementContext:
            <managementContext createConnector="true"
                useMBeanServer="true"
                createMBeanServer="true"
                />
        </managementContext>

and broker2 now has this managementContext:
      <managementContext>
            <managementContext createConnector="true"
                useMBeanServer="true"
                createMBeanServer="true"
                />
        </managementContext>

Broker1 reports:
JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

And broker2:
Failed to start JMX connector Cannot bind to URL
[rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException:
jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]. Will
restart management to re-create JMX connector, trying to remedy this issue.

And, naturally it doesn't connect to the mbean server.




--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-proper-way-to-configure-multiple-brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715623.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by Tim Bain <tb...@alumni.duke.edu>.
Why is your connectorPort in your second management context 1099?
Shouldn't that be 12099?

On Wed, Aug 17, 2016 at 12:22 PM, mlange <ml...@anwb.nl> wrote:

> I should note the following few things:
> - Java version is 1.7.0 (openJDK)
> - ActiveMQ is version 5.14.0
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/What-is-the-proper-way-to-configure-multiple-
> brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715590.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: What is the proper way to configure multiple brokers on the same machine in regard to jmx

Posted by mlange <ml...@anwb.nl>.
I should note the following few things:
- Java version is 1.7.0 (openJDK) 
- ActiveMQ is version 5.14.0





--
View this message in context: http://activemq.2283324.n4.nabble.com/What-is-the-proper-way-to-configure-multiple-brokers-on-the-same-machine-in-regard-to-jmx-tp4715589p4715590.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.