You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by j0llyr0g3r <ti...@wincor-nixdorf.com> on 2007/10/05 22:26:20 UTC

How to configure AMQ to use a database cluster instead of a single db?

Hey folks, 

i have a configuration problem which hopefully can be solved:

I have an up and running mySQL-Cluster consisting of 2 nodes (let's say
mydbhost1 and mydbhost2) which works so far as i can tell.

Currently i have two AMQ-instances, configured as a cluster as well.

But here is the problem:

How can i tell activemq to use the __other__ mySQL-node in case its primary
mysql-node shuts down?

Currently my data-source configuration in AMQ looks like this, using
"mydbhost1":

  <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
     <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
     <property name="url"
value="jdbc:mysql://mydbhost1/activemq?relaxAutoCommit=true"/>
     <property name="username" value="wnmf"/>
     <property name="password" value="wnmf"/>
     <property name="poolPreparedStatements" value="true"/>
  </bean> 

But how can i tell AMQ to use my "mydbhost2" in case "mydbhost1" fails over?

Can i simply set a comma-separated list in the configuration like:

<property name="url" value="jdbc:mysql://mydbhost1/activemq,
jdbc:mysql://mydbhost2/activemq"/>

?

I didn't find anything in the manual or via google......

Any help is highly appreciated!
-- 
View this message in context: http://www.nabble.com/How-to-configure-AMQ-to-use-a-database-cluster-instead-of-a-single-db--tf4577442s2354.html#a13066825
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How to configure AMQ to use a database cluster instead of a single db?

Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi,

i assume you have an already configured mysql-cluster with a database called
activemq_1:


    *  Use a data-source like the following for the activemq-instance: 

 <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
   <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
   <property name="url"
value="jdbc:mysql://db_host_1,db_host_2/activemq1?relaxAutoCommit=true"/>
   <property name="username" value="wnmf"/>
   <property name="password" value="wnmf"/>
   <property name="poolPreparedStatements" value="true"/>
 </bean>


    *  Note the url 

jdbc:mysql://db_host_1,db_host_2/activemq1?

This tells activemq basically that there are 2 Databasehosts with a database
called activemq1. In case one host goes down, AMQ automatically fails over
the other host. 

This should do the trick...



Ivan Jovanovic wrote:
> 
> I have the same question?
> 
> Did anyone implemented this kind of configuration?
> 
> Cheers,
> Ivan
> 
> j0llyr0g3r wrote:
>> 
>> Hey folks, 
>> 
>> i have a configuration problem which hopefully can be solved:
>> 
>> I have an up and running mySQL-Cluster consisting of 2 nodes (let's say
>> mydbhost1 and mydbhost2) which works so far as i can tell.
>> 
>> Currently i have two AMQ-instances, configured as a cluster as well.
>> 
>> But here is the problem:
>> 
>> How can i tell activemq to use the __other__ mySQL-node in case its
>> primary mysql-node shuts down?
>> 
>> Currently my data-source configuration in AMQ looks like this, using
>> "mydbhost1":
>> 
>>   <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
>> destroy-method="close">
>>      <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>>      <property name="url"
>> value="jdbc:mysql://mydbhost1/activemq?relaxAutoCommit=true"/>
>>      <property name="username" value="wnmf"/>
>>      <property name="password" value="wnmf"/>
>>      <property name="poolPreparedStatements" value="true"/>
>>   </bean> 
>> 
>> But how can i tell AMQ to use my "mydbhost2" in case "mydbhost1" fails
>> over?
>> 
>> Can i simply set a comma-separated list in the configuration like:
>> 
>> <property name="url" value="jdbc:mysql://mydbhost1/activemq,
>> jdbc:mysql://mydbhost2/activemq"/>
>> 
>> ?
>> 
>> I didn't find anything in the manual or via google......
>> 
>> Any help is highly appreciated!
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-configure-AMQ-to-use-a-database-cluster-instead-of-a-single-db--tp13066825s2354p17106434.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: How to configure AMQ to use a database cluster instead of a single db?

Posted by Ivan Jovanovic <iv...@gmail.com>.
I have the same question?

Did anyone implemented this kind of configuration?

Cheers,
Ivan

j0llyr0g3r wrote:
> 
> Hey folks, 
> 
> i have a configuration problem which hopefully can be solved:
> 
> I have an up and running mySQL-Cluster consisting of 2 nodes (let's say
> mydbhost1 and mydbhost2) which works so far as i can tell.
> 
> Currently i have two AMQ-instances, configured as a cluster as well.
> 
> But here is the problem:
> 
> How can i tell activemq to use the __other__ mySQL-node in case its
> primary mysql-node shuts down?
> 
> Currently my data-source configuration in AMQ looks like this, using
> "mydbhost1":
> 
>   <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>      <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>      <property name="url"
> value="jdbc:mysql://mydbhost1/activemq?relaxAutoCommit=true"/>
>      <property name="username" value="wnmf"/>
>      <property name="password" value="wnmf"/>
>      <property name="poolPreparedStatements" value="true"/>
>   </bean> 
> 
> But how can i tell AMQ to use my "mydbhost2" in case "mydbhost1" fails
> over?
> 
> Can i simply set a comma-separated list in the configuration like:
> 
> <property name="url" value="jdbc:mysql://mydbhost1/activemq,
> jdbc:mysql://mydbhost2/activemq"/>
> 
> ?
> 
> I didn't find anything in the manual or via google......
> 
> Any help is highly appreciated!
> 

-- 
View this message in context: http://www.nabble.com/How-to-configure-AMQ-to-use-a-database-cluster-instead-of-a-single-db--tp13066825s2354p17106207.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.