You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by JordanC <jo...@gmail.com> on 2016/12/06 17:20:11 UTC

Configuring peer transport with shared data directory

I need some help configuring ActiveMQ to work with my clustered Java
application. What I want is to be able to run a variable number of nodes and
have messages distributed among the nodes and have high availability such
that if a node goes down, messaged queued on that node will be processed by
other nodes.

The configuration I have tried to use is Peer transport. Messages were
distributed among the nodes which was what I wanted. However, because each
broker had its own data directory, if a node went down, messages that were
queued on that node do not get consumed until the node is brought back up. I
thought using a shared directory should fix this however the problem I run
into is that any nodes whose brokers are waiting to acquire the file lock
are blocked from processing so only messages sent on a single node can be
consumed by that node. All other nodes can only queue messages and nothing
else.

Does using peer transport with a shared data directory not do what I need it
to do? If not, what should the configuration be?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuring-peer-transport-with-shared-data-directory-tp4719809.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Configuring peer transport with shared data directory

Posted by JordanC <jo...@gmail.com>.
Just to clarify, I won't have multiple brokers running on the same JVM. Each
broker will be running on a separate JVM instance along with my J2EE
application.

Thank you for the suggestion about master/slave Tim. I am now trying to use
master/slave as follows to support the high availability needed:
Standalone broker 1 configured with transport connector tcp://<host1>:61616
Standalone broker 2 configured with transport connector tcp://<host2>:61616
Standalone broker 3 configured with transport connector tcp://<host3>:61616

Each of the brokers point to a shared data directory.

Each client instance is configured using a brokerURL of
failover:(tcp://<host1>:61616,tcp://<host2>:61616,tcp://<host3>:61616)

Each broker is initialized on startup of an instance of my J2EE application.
The number of instances can be variable so the brokerURL of each client will
be dynamically updated as nodes are added or removed.

Does the configuration I am using seem like the best approach or is there a
better option?


Tim Bain wrote
> ActiveMQ doesn't provide a way to have replication of messages between
> active brokers.  We provide high availability (i.e. the ability to not
> lose
> the messages in a broker that crashes) via master/slave pairs where only
> one broker is active at a time and they use (for KahaDB) a shared
> filesystem that only the two of them see to ensure that 1) only one of
> them
> is active at a time, and 2) if the current master goes down, the slave can
> pick up where the master left off.
> 
> Typically it's not possible to set up master/slave pairs for embedded
> brokers (even if you tried, usually they would both be embedded in the
> same
> process, so both would exit when one did),so typically it's not possible
> to
> do what you want.  This is one of the limitations of embedded brokers; if
> it's an unacceptable one, don't use them and use only standalone ones
> instead.
> 
> Tim
> 
> On Dec 6, 2016 10:57 AM, "JordanC" &lt;

> jordanchang111@

> &gt; wrote:
> 
>> I need some help configuring ActiveMQ to work with my clustered Java
>> application. What I want is to be able to run a variable number of nodes
>> and
>> have messages distributed among the nodes and have high availability such
>> that if a node goes down, messaged queued on that node will be processed
>> by
>> other nodes.
>>
>> The configuration I have tried to use is Peer transport. Messages were
>> distributed among the nodes which was what I wanted. However, because
>> each
>> broker had its own data directory, if a node went down, messages that
>> were
>> queued on that node do not get consumed until the node is brought back
>> up.
>> I
>> thought using a shared directory should fix this however the problem I
>> run
>> into is that any nodes whose brokers are waiting to acquire the file lock
>> are blocked from processing so only messages sent on a single node can be
>> consumed by that node. All other nodes can only queue messages and
>> nothing
>> else.
>>
>> Does using peer transport with a shared data directory not do what I need
>> it
>> to do? If not, what should the configuration be?
>>
>>
>>
>> --
>> View this message in context: http://activemq.2283324.n4.
>> nabble.com/Configuring-peer-transport-with-shared-data-
>> directory-tp4719809.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>





--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuring-peer-transport-with-shared-data-directory-tp4719809p4719988.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Configuring peer transport with shared data directory

Posted by Tim Bain <tb...@alumni.duke.edu>.
ActiveMQ doesn't provide a way to have replication of messages between
active brokers.  We provide high availability (i.e. the ability to not lose
the messages in a broker that crashes) via master/slave pairs where only
one broker is active at a time and they use (for KahaDB) a shared
filesystem that only the two of them see to ensure that 1) only one of them
is active at a time, and 2) if the current master goes down, the slave can
pick up where the master left off.

Typically it's not possible to set up master/slave pairs for embedded
brokers (even if you tried, usually they would both be embedded in the same
process, so both would exit when one did),so typically it's not possible to
do what you want.  This is one of the limitations of embedded brokers; if
it's an unacceptable one, don't use them and use only standalone ones
instead.

Tim

On Dec 6, 2016 10:57 AM, "JordanC" <jo...@gmail.com> wrote:

> I need some help configuring ActiveMQ to work with my clustered Java
> application. What I want is to be able to run a variable number of nodes
> and
> have messages distributed among the nodes and have high availability such
> that if a node goes down, messaged queued on that node will be processed by
> other nodes.
>
> The configuration I have tried to use is Peer transport. Messages were
> distributed among the nodes which was what I wanted. However, because each
> broker had its own data directory, if a node went down, messages that were
> queued on that node do not get consumed until the node is brought back up.
> I
> thought using a shared directory should fix this however the problem I run
> into is that any nodes whose brokers are waiting to acquire the file lock
> are blocked from processing so only messages sent on a single node can be
> consumed by that node. All other nodes can only queue messages and nothing
> else.
>
> Does using peer transport with a shared data directory not do what I need
> it
> to do? If not, what should the configuration be?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Configuring-peer-transport-with-shared-data-
> directory-tp4719809.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>