Default JMX Connectors Failover for JDBC Master Slave

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Default JMX Connectors Failover for JDBC Master Slave

Gaurav Sharma
For the JDBC Master Slave config, just like there exists the Failover
Transport for the broker url, what is the best way to specify the JMX
hosts in a properties file:
jmxUrl=service:jmx:rmi:///jndi/rmi://<host1>:1616/jmxrmi, \
           service:jmx:rmi:///jndi/rmi://<host2>:1616/jmxrmi, \
           service:jmx:rmi:///jndi/rmi://<host3>:1616/jmxrmi

so that I don't have to worry about managing 3 MBeanServerConnection's
in my code and then trying to figure which one is the master or which
one is alive, re-election, etc? The alternative of managing the three
references and error-handling, is just messier.

Thanks in advance for the help.

-gaurav
Reply | Threaded
Open this post in threaded view
|

Re: Default JMX Connectors Failover for JDBC Master Slave

gtully
There is no easy solution for this at the moment.

Since https://issues.apache.org/jira/browse/AMQ-2306 both the master
and slave expose them selves over JMX so both urls will be valid.
The difference is that only one will report isSlave==false

There is a jmx facade used by the web console that could be useful if
your client has java code, but it needs some additional smarts to be
aware of the isSlave attribute on a broker.

Currently it is happy if it finds a broker MBean.

Have a peek at:
org.apache.activemq.web.RemoteJMXBrokerFacade#createConnection in [1]

Seems like that facade needs to be able to iterate through the list of
urls or restrict access to just the master. I think it would make a
sensible enhancement.

[1] http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?view=markup

On 5 September 2012 06:18, Gaurav Sharma <[hidden email]> wrote:

> For the JDBC Master Slave config, just like there exists the Failover
> Transport for the broker url, what is the best way to specify the JMX
> hosts in a properties file:
> jmxUrl=service:jmx:rmi:///jndi/rmi://<host1>:1616/jmxrmi, \
>            service:jmx:rmi:///jndi/rmi://<host2>:1616/jmxrmi, \
>            service:jmx:rmi:///jndi/rmi://<host3>:1616/jmxrmi
>
> so that I don't have to worry about managing 3 MBeanServerConnection's
> in my code and then trying to figure which one is the master or which
> one is alive, re-election, etc? The alternative of managing the three
> references and error-handling, is just messier.
>
> Thanks in advance for the help.
>
> -gaurav



--
http://fusesource.com
http://blog.garytully.com
Reply | Threaded
Open this post in threaded view
|

Re: Default JMX Connectors Failover for JDBC Master Slave

gtully
hmm. I see we already have an issue for the RemoteJMXBrokerFacade  at
https://issues.apache.org/jira/browse/AMQ-2785
vote it up I guess or if you can, submit a patch. All contributions
most welcome.

On 5 September 2012 12:00, Gary Tully <[hidden email]> wrote:

> There is no easy solution for this at the moment.
>
> Since https://issues.apache.org/jira/browse/AMQ-2306 both the master
> and slave expose them selves over JMX so both urls will be valid.
> The difference is that only one will report isSlave==false
>
> There is a jmx facade used by the web console that could be useful if
> your client has java code, but it needs some additional smarts to be
> aware of the isSlave attribute on a broker.
>
> Currently it is happy if it finds a broker MBean.
>
> Have a peek at:
> org.apache.activemq.web.RemoteJMXBrokerFacade#createConnection in [1]
>
> Seems like that facade needs to be able to iterate through the list of
> urls or restrict access to just the master. I think it would make a
> sensible enhancement.
>
> [1] http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?view=markup
>
> On 5 September 2012 06:18, Gaurav Sharma <[hidden email]> wrote:
>> For the JDBC Master Slave config, just like there exists the Failover
>> Transport for the broker url, what is the best way to specify the JMX
>> hosts in a properties file:
>> jmxUrl=service:jmx:rmi:///jndi/rmi://<host1>:1616/jmxrmi, \
>>            service:jmx:rmi:///jndi/rmi://<host2>:1616/jmxrmi, \
>>            service:jmx:rmi:///jndi/rmi://<host3>:1616/jmxrmi
>>
>> so that I don't have to worry about managing 3 MBeanServerConnection's
>> in my code and then trying to figure which one is the master or which
>> one is alive, re-election, etc? The alternative of managing the three
>> references and error-handling, is just messier.
>>
>> Thanks in advance for the help.
>>
>> -gaurav
>
>
>
> --
> http://fusesource.com
> http://blog.garytully.com



--
http://fusesource.com
http://blog.garytully.com
Reply | Threaded
Open this post in threaded view
|

Re: Default JMX Connectors Failover for JDBC Master Slave

Gaurav Sharma
Gary - Thanks for the pointers. For my in-house work, I am testing
with the comma-separated list of jmx url's and just establishing
connections to them in-order and returning the MBeanServerConnection
for the first one that works. I also have a daemon thread to monitor
this connection failure and try the others in the list.. in a way,
simulating the failover transport like for the broker url's.

I looked at the RemoteJMXBrokerFacade but it is very high up residing
in the web module. Should I create a ticket for 'core' to implement a
failover-transport like implementation for the JMX URL's?
Thank you.


On Wed, Sep 5, 2012 at 4:11 AM, Gary Tully <[hidden email]> wrote:

> hmm. I see we already have an issue for the RemoteJMXBrokerFacade  at
> https://issues.apache.org/jira/browse/AMQ-2785
> vote it up I guess or if you can, submit a patch. All contributions
> most welcome.
>
> On 5 September 2012 12:00, Gary Tully <[hidden email]> wrote:
>> There is no easy solution for this at the moment.
>>
>> Since https://issues.apache.org/jira/browse/AMQ-2306 both the master
>> and slave expose them selves over JMX so both urls will be valid.
>> The difference is that only one will report isSlave==false
>>
>> There is a jmx facade used by the web console that could be useful if
>> your client has java code, but it needs some additional smarts to be
>> aware of the isSlave attribute on a broker.
>>
>> Currently it is happy if it finds a broker MBean.
>>
>> Have a peek at:
>> org.apache.activemq.web.RemoteJMXBrokerFacade#createConnection in [1]
>>
>> Seems like that facade needs to be able to iterate through the list of
>> urls or restrict access to just the master. I think it would make a
>> sensible enhancement.
>>
>> [1] http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?view=markup
>>
>> On 5 September 2012 06:18, Gaurav Sharma <[hidden email]> wrote:
>>> For the JDBC Master Slave config, just like there exists the Failover
>>> Transport for the broker url, what is the best way to specify the JMX
>>> hosts in a properties file:
>>> jmxUrl=service:jmx:rmi:///jndi/rmi://<host1>:1616/jmxrmi, \
>>>            service:jmx:rmi:///jndi/rmi://<host2>:1616/jmxrmi, \
>>>            service:jmx:rmi:///jndi/rmi://<host3>:1616/jmxrmi
>>>
>>> so that I don't have to worry about managing 3 MBeanServerConnection's
>>> in my code and then trying to figure which one is the master or which
>>> one is alive, re-election, etc? The alternative of managing the three
>>> references and error-handling, is just messier.
>>>
>>> Thanks in advance for the help.
>>>
>>> -gaurav
>>
>>
>>
>> --
>> http://fusesource.com
>> http://blog.garytully.com
>
>
>
> --
> http://fusesource.com
> http://blog.garytully.com
Reply | Threaded
Open this post in threaded view
|

Re: Default JMX Connectors Failover for JDBC Master Slave

gtully
sure. and link it to  https://issues.apache.org/jira/browse/AMQ-2306

I think it makes sense to have that in core so that it is more easily
accessible.

On 5 September 2012 23:31, Gaurav Sharma <[hidden email]> wrote:

> Gary - Thanks for the pointers. For my in-house work, I am testing
> with the comma-separated list of jmx url's and just establishing
> connections to them in-order and returning the MBeanServerConnection
> for the first one that works. I also have a daemon thread to monitor
> this connection failure and try the others in the list.. in a way,
> simulating the failover transport like for the broker url's.
>
> I looked at the RemoteJMXBrokerFacade but it is very high up residing
> in the web module. Should I create a ticket for 'core' to implement a
> failover-transport like implementation for the JMX URL's?
> Thank you.
>
>
> On Wed, Sep 5, 2012 at 4:11 AM, Gary Tully <[hidden email]> wrote:
>> hmm. I see we already have an issue for the RemoteJMXBrokerFacade  at
>> https://issues.apache.org/jira/browse/AMQ-2785
>> vote it up I guess or if you can, submit a patch. All contributions
>> most welcome.
>>
>> On 5 September 2012 12:00, Gary Tully <[hidden email]> wrote:
>>> There is no easy solution for this at the moment.
>>>
>>> Since https://issues.apache.org/jira/browse/AMQ-2306 both the master
>>> and slave expose them selves over JMX so both urls will be valid.
>>> The difference is that only one will report isSlave==false
>>>
>>> There is a jmx facade used by the web console that could be useful if
>>> your client has java code, but it needs some additional smarts to be
>>> aware of the isSlave attribute on a broker.
>>>
>>> Currently it is happy if it finds a broker MBean.
>>>
>>> Have a peek at:
>>> org.apache.activemq.web.RemoteJMXBrokerFacade#createConnection in [1]
>>>
>>> Seems like that facade needs to be able to iterate through the list of
>>> urls or restrict access to just the master. I think it would make a
>>> sensible enhancement.
>>>
>>> [1] http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?view=markup
>>>
>>> On 5 September 2012 06:18, Gaurav Sharma <[hidden email]> wrote:
>>>> For the JDBC Master Slave config, just like there exists the Failover
>>>> Transport for the broker url, what is the best way to specify the JMX
>>>> hosts in a properties file:
>>>> jmxUrl=service:jmx:rmi:///jndi/rmi://<host1>:1616/jmxrmi, \
>>>>            service:jmx:rmi:///jndi/rmi://<host2>:1616/jmxrmi, \
>>>>            service:jmx:rmi:///jndi/rmi://<host3>:1616/jmxrmi
>>>>
>>>> so that I don't have to worry about managing 3 MBeanServerConnection's
>>>> in my code and then trying to figure which one is the master or which
>>>> one is alive, re-election, etc? The alternative of managing the three
>>>> references and error-handling, is just messier.
>>>>
>>>> Thanks in advance for the help.
>>>>
>>>> -gaurav
>>>
>>>
>>>
>>> --
>>> http://fusesource.com
>>> http://blog.garytully.com
>>
>>
>>
>> --
>> http://fusesource.com
>> http://blog.garytully.com



--
http://fusesource.com
http://blog.garytully.com