You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by bobsponge <ru...@tecnicasdeingenieria.com> on 2007/07/06 14:21:12 UTC
Multiple broker instances
Hello,
I'm developing a web application and for some reasons a multi-brokers
environment is needed. By multi-broker I mean that I need two independent
instances of brokers running, each one configured to access different queues
(with different sets of journal and db persistence schemes). I don't really
know if this is possible. Every time I run the application the first broker
is created with no problems but the second one always shows the next
exception:
javax.management.InstanceAlreadyExistsException:
org.apache.activemq:BrokerName=localhost,Type=Broker
The brokers are created with tcp transports and different ports:
tcp://localhost:30000 and tcp://localhost:30001
I've tried to change the broker names but it does not works at all...
Does any body know if it's possible to run two (or more) brokers in the same
application at the same time?
Thank you
--
View this message in context: http://www.nabble.com/Multiple-broker-instances-tf4035160s2354.html#a11463210
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Re: Multiple broker instances
Posted by chahir <ch...@yahoo.fr>.
What was the error message?
I've tried to start two brokers on the same machine and everything was
alright.
Did you modified the port numbers of the second broker? the ACTIVEMQ_HOME?
...
--
View this message in context: http://www.nabble.com/Multiple-broker-instances-tf4035160s2354.html#a11520369
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Re: Multiple broker instances
Posted by bobsponge <ru...@tecnicasdeingenieria.com>.
Hello,
Ok, It's a little long to explain, but to sum up, imagine two groups, group
G1 is composed of nodes A and B and group G2 is composed of nodes C and D.
G1 must deal with information I1 and G2 with I2.
Each node from the same group acts the same way and they've a local broker
and persits locally so queues in nodes A and B store information I1 (mirror
nodes, if one fails the other one takes over and the service continues) and
the same thing happens in the group G2. When some data is requested it must
be removed from all the group's nodes so the storage media from a group
should be shared (db or file system).
At some point node D fails and the system controller reconfigure the nodes
and force the node B to join group G2 (it will be joined to G1 as well) so B
must synchronize the node D persistence storage in order to mirror this node
(node B will be a node A mirror and a node D mirror). Because a shared file
system scheme won't be used for the information persistence,a shared db will
be tested. G1 and G2 will use their own shared db (DB1 and DB2). If node D
fails and B must join to group G2, it seems easy to start a different broker
in B with shared db DB2 as the persistence media. Anyway, there are many
other ways to get the same behavior but now I'm checking if this is
feasible.
Greetings
James.Strachan wrote:
>
> On 7/10/07, bobsponge <ru...@tecnicasdeingenieria.com> wrote:
>> Hello James,
>>
>> I need two or more brokers working at the same time in the same machine
>> because the application is composed of several machines (nodes). Every
>> node
>> belongs to a group. In general data is transferred between nodes from the
>> same group, no problem. But a node can bind to another group so the same
>> node can communicates with two (or more) groups. The information must
>> separately persists in this node so two brokers are needed, because of
>> the
>> persistence issues...
>
> I still don't get it; why 2 brokers in the same JVM on the same box?
>
> Usually for high performance a broker persists to the local hard
> drive; so I don't understand the benefit from having 2 different
> brokers writing to 2 different directories (or even different DBs)
>
>> I tried to configure the brokers with different names building an URI
>> like
>> this: tcp://localhost:50000?broker.brokerName=broker1 , but it didn't
>> work
>> at all.
>
>
> You configure the broker names in the activemq.xml. See the brokerName
> atttribute in the one that comes with the binary distro
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
>
--
View this message in context: http://www.nabble.com/Multiple-broker-instances-tf4035160s2354.html#a11517382
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Re: Multiple broker instances
Posted by James Strachan <ja...@gmail.com>.
On 7/10/07, bobsponge <ru...@tecnicasdeingenieria.com> wrote:
> Hello James,
>
> I need two or more brokers working at the same time in the same machine
> because the application is composed of several machines (nodes). Every node
> belongs to a group. In general data is transferred between nodes from the
> same group, no problem. But a node can bind to another group so the same
> node can communicates with two (or more) groups. The information must
> separately persists in this node so two brokers are needed, because of the
> persistence issues...
I still don't get it; why 2 brokers in the same JVM on the same box?
Usually for high performance a broker persists to the local hard
drive; so I don't understand the benefit from having 2 different
brokers writing to 2 different directories (or even different DBs)
> I tried to configure the brokers with different names building an URI like
> this: tcp://localhost:50000?broker.brokerName=broker1 , but it didn't work
> at all.
You configure the broker names in the activemq.xml. See the brokerName
atttribute in the one that comes with the binary distro
--
James
-------
http://macstrac.blogspot.com/
Re: Multiple broker instances
Posted by bobsponge <ru...@tecnicasdeingenieria.com>.
Hello James,
I need two or more brokers working at the same time in the same machine
because the application is composed of several machines (nodes). Every node
belongs to a group. In general data is transferred between nodes from the
same group, no problem. But a node can bind to another group so the same
node can communicates with two (or more) groups. The information must
separately persists in this node so two brokers are needed, because of the
persistence issues...
I tried to configure the brokers with different names building an URI like
this: tcp://localhost:50000?broker.brokerName=broker1 , but it didn't work
at all. Looking at the activemq source code I found a class named
JmsMultipleBrokersTestSupport where brokers are named using .setName(...), I
tried and it works!
So it's possible to run more than 1 broker at the same time (but not using
vm transport, it seems to be allowed just one broker per JVM, even with
different names) with different names, as you told me.
Thank you for your help.
James.Strachan wrote:
>
> On 7/6/07, bobsponge <ru...@tecnicasdeingenieria.com> wrote:
>>
>> Hello,
>>
>> I'm developing a web application and for some reasons a multi-brokers
>> environment is needed. By multi-broker I mean that I need two independent
>> instances of brokers running, each one configured to access different
>> queues
>> (with different sets of journal and db persistence schemes).
>> I don't really
>> know if this is possible.
>
> Sounds fine. Though why have 2 brokers in the same JVM?
>
>
>> Every time I run the application the first broker
>> is created with no problems but the second one always shows the next
>> exception:
>>
>> javax.management.InstanceAlreadyExistsException:
>> org.apache.activemq:BrokerName=localhost,Type=Broker
>>
>> The brokers are created with tcp transports and different ports:
>>
>> tcp://localhost:30000 and tcp://localhost:30001
>>
>>
>> I've tried to change the broker names but it does not works at all...
>>
>> Does any body know if it's possible to run two (or more) brokers in the
>> same
>> application at the same time?
>
> Hopefully if you run 2 brokers with different names, the JMX stuff
> should just work. If you do that, show us the stack trace you get & we
> can figure it out
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
>
--
View this message in context: http://www.nabble.com/Multiple-broker-instances-tf4035160s2354.html#a11516374
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Re: Multiple broker instances
Posted by James Strachan <ja...@gmail.com>.
On 7/6/07, bobsponge <ru...@tecnicasdeingenieria.com> wrote:
>
> Hello,
>
> I'm developing a web application and for some reasons a multi-brokers
> environment is needed. By multi-broker I mean that I need two independent
> instances of brokers running, each one configured to access different queues
> (with different sets of journal and db persistence schemes).
> I don't really
> know if this is possible.
Sounds fine. Though why have 2 brokers in the same JVM?
> Every time I run the application the first broker
> is created with no problems but the second one always shows the next
> exception:
>
> javax.management.InstanceAlreadyExistsException:
> org.apache.activemq:BrokerName=localhost,Type=Broker
>
> The brokers are created with tcp transports and different ports:
>
> tcp://localhost:30000 and tcp://localhost:30001
>
>
> I've tried to change the broker names but it does not works at all...
>
> Does any body know if it's possible to run two (or more) brokers in the same
> application at the same time?
Hopefully if you run 2 brokers with different names, the JMX stuff
should just work. If you do that, show us the stack trace you get & we
can figure it out
--
James
-------
http://macstrac.blogspot.com/