You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by deepak_a <an...@gmail.com> on 2013/08/14 10:44:04 UTC

regarding use of Advisory messages for node failure in a Cluster

Hi,

My architecture uses Jboss+ActiveMQ (in integrated mode)
We have achieved HA (high availability) & HS (High Scalablity).

A high level design looks like the below
http://activemq.2283324.n4.nabble.com/ActiveMQ-Clustered-JBoss-and-JDBC-Master-Slave-td2348023.html#a2348028

Query is - when the primary node fails, the secondary node acquires a lock
on the database and becomes master (HA).

Is is possible to use Advisory messages - to let know my application as to
which node has gone down and which node has acquired the lock on the
database?

Our application displays the Queue statistics (count, depth of messages etc)
in  the UI
Intention is - if and when a node acquires a lock and becomes the Primary
node, I let the broker broadcast its IP address to the application so that -
the app can listen to *that* specific broker's JMX to get Queue/Topic
statistics.

Is this a right usage of Advisory messages?


regards
D




--
View this message in context: http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: regarding use of Advisory messages for node failure in a Cluster

Posted by deepak_a <an...@gmail.com>.
Just re-read your earlier message

"you won't be able to listen to that on the slave, cause you won't be able
to connect! "

That's not true, since my application does connect because it has a
fail-over, what i does not know is the IP address at run-time to connect to
JMX.
The topic itself should be visible in JMX, right? But I don't see it.

These are the only ones I see

BrokerName=jboss-activemq-broker,ConnectorName=tcp_//0.0.0.0_61617,Type=Connector
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Connection,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Consumer.Queue.ActiveMQ.DLQ,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Consumer.Queue.queue.incomingEvents,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Consumer.Queue.queue.incomingReplies,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Consumer.Queue.queue.incomingWorkflow,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Consumer.Queue.queue.integrationExceptions,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Consumer.Topic.topic.closedUserActivities,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Queue,Type=Topic
BrokerName=jboss-activemq-broker,Destination=ActiveMQ.Advisory.Topic,Type=Topic



--
View this message in context: http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361p4670421.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: regarding use of Advisory messages for node failure in a Cluster

Posted by deepak_a <an...@gmail.com>.
Hi,

Thanks.
Another idea I am thinking is
"broadcast" a message to a MDB, with its IPAddress as soon as it acquires a
lock is acquired on the Database.

I am following a strategy as shown below
http://www.liquid-reality.de/display/liquid/2011/11/11/Hot+Standby+failover+for+Apache+Camel+routes
for holding locks on Database. As soon as Camel acquires lock - this will
fire a message indicating the Master node to the app.

But just wanted to make sure I am not re-inventing the wheel with this..... 


regards,
D



--
View this message in context: http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361p4670420.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: regarding use of Advisory messages for node failure in a Cluster

Posted by Christian Posta <ch...@gmail.com>.
I see. If you used fuse fabric to manage the brokers, zookeeper would keep
info about which is master/slave and you could set a watch on those nodes
and be updated when something causes the nodes to get updated.

Out of the box, without the help of a distributed cluster coordinator, not
sure how many options you have.

poor man's approach without fuse fabric could be to deploy a camel route
along with each broker that publishes to zookeeper the state of the broker
(is master? and some host/port info), and then if your monitoring app loses
jmx connection, it can cycle through the nodes in zookeeper to find out
which is the correct next master.

The way the webconsole currently does it is by knowing about the
master/slave ahead of time. but if your slaves in the cluster can be
dynamic, would need to rely on some other way to figure them out.

Additionally, you could try to use an HTTP discovery agent to publish a
broker's transports. You can use that to try to determine what the host
name is and just assume default ports.
Take a look
at org.apache.activemq.transport.discovery.http.DiscoveryRegistryServlet
which would need to be exposed... and the transports in your broker would
need to publish to the discovery url:

http://activemq.apache.org/discovery-transport-reference.html

Those are my thoughts :) others might chime in...

On Wed, Aug 14, 2013 at 10:11 AM, deepak_a <an...@gmail.com> wrote:

> Hi,
>
> May be I am not explaining properly.
>
> My app connects to the Master or Slave based on the HostName/IP-Address.
>
> Prior to clustering my app always connected to localhost/default-JMX-port
> DEFAULT_MESSAGE_BUS_JMX_HOST = "localhost";
> DEFAULT_MESSAGE_BUS_JMX_PORT = 19999;
>
> Now with clustering my slave will become Primary and vice versa.
> And as it stands - my app does not know which node's JMX to connect to.
>
> *Note*: HA/HS itself is fine (I am able to get messages routed across
> properly if master goes down), i.e. my ejb's have a fail-over set up, so
> they connect to the right node/broker. i.e.
> failover:(tcp://A.B.C.D:61616,tcp://E.F.G.H:61617)?randomize=false
>
> regards
> D
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361p4670382.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: regarding use of Advisory messages for node failure in a Cluster

Posted by deepak_a <an...@gmail.com>.
Hi,

May be I am not explaining properly.

My app connects to the Master or Slave based on the HostName/IP-Address.

Prior to clustering my app always connected to localhost/default-JMX-port
DEFAULT_MESSAGE_BUS_JMX_HOST = "localhost";
DEFAULT_MESSAGE_BUS_JMX_PORT = 19999;

Now with clustering my slave will become Primary and vice versa.
And as it stands - my app does not know which node's JMX to connect to.

*Note*: HA/HS itself is fine (I am able to get messages routed across
properly if master goes down), i.e. my ejb's have a fail-over set up, so
they connect to the right node/broker. i.e. 
failover:(tcp://A.B.C.D:61616,tcp://E.F.G.H:61617)?randomize=false

regards
D



--
View this message in context: http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361p4670382.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: regarding use of Advisory messages for node failure in a Cluster

Posted by Christian Posta <ch...@gmail.com>.
yep, jumped too far ahead of myself.

you won't be able to listen to that on the slave, cause you won't be able
to connect!

can your app have the connection string for your slave and then if master
fails, just connect to the slave?



On Wed, Aug 14, 2013 at 9:33 AM, deepak_a <an...@gmail.com> wrote:

> Thanks,
>
> As per
> http://activemq.apache.org/advisory-message.html
>
> I see that
> ActiveMQ.Advisory.MasterBroker
> is set to True (enabled by default).
>
> I have also added the following in my broker-config.xml
>
> <destinationPolicy>
>    <policyMap><policyEntries>
>       <policyEntry topic=">" advisoryForConsumed="true" />
>    </policyEntries></policyMap>
> </destinationPolicy>
>
> But I don't even see the Queue ActiveMQ.Advisory.MasterBroker in my JMX
> console.
>
> Is there any additional config change to be done to enable the broker fire
> a
> message?
> Another query I have is around the data-structure of the message.
> The link above says #null#
>
> What type of information is published to the Queue?
>
>
> regards
> D
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361p4670380.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: regarding use of Advisory messages for node failure in a Cluster

Posted by deepak_a <an...@gmail.com>.
Thanks,

As per
http://activemq.apache.org/advisory-message.html

I see that 
ActiveMQ.Advisory.MasterBroker 
is set to True (enabled by default).

I have also added the following in my broker-config.xml

<destinationPolicy>
   <policyMap><policyEntries> 
      <policyEntry topic=">" advisoryForConsumed="true" />
   </policyEntries></policyMap>
</destinationPolicy>

But I don't even see the Queue ActiveMQ.Advisory.MasterBroker in my JMX
console.

Is there any additional config change to be done to enable the broker fire a
message?
Another query I have is around the data-structure of the message.
The link above says #null#

What type of information is published to the Queue?


regards
D



--
View this message in context: http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361p4670380.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: regarding use of Advisory messages for node failure in a Cluster

Posted by Christian Posta <ch...@gmail.com>.
Yes, that's an appropriate way.
Listen to this advisory topic on the slave:

ActiveMQ.Advisory.MasterBroker


And when it becomes master, it should fire an advisory.





On Wed, Aug 14, 2013 at 1:44 AM, deepak_a <an...@gmail.com> wrote:

> Hi,
>
> My architecture uses Jboss+ActiveMQ (in integrated mode)
> We have achieved HA (high availability) & HS (High Scalablity).
>
> A high level design looks like the below
>
> http://activemq.2283324.n4.nabble.com/ActiveMQ-Clustered-JBoss-and-JDBC-Master-Slave-td2348023.html#a2348028
>
> Query is - when the primary node fails, the secondary node acquires a lock
> on the database and becomes master (HA).
>
> Is is possible to use Advisory messages - to let know my application as to
> which node has gone down and which node has acquired the lock on the
> database?
>
> Our application displays the Queue statistics (count, depth of messages
> etc)
> in  the UI
> Intention is - if and when a node acquires a lock and becomes the Primary
> node, I let the broker broadcast its IP address to the application so that
> -
> the app can listen to *that* specific broker's JMX to get Queue/Topic
> statistics.
>
> Is this a right usage of Advisory messages?
>
>
> regards
> D
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/regarding-use-of-Advisory-messages-for-node-failure-in-a-Cluster-tp4670361.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta