You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by activeMqUser <ma...@connectm.com> on 2010/09/13 13:56:05 UTC
Failover problem
Hello,
i am facing a problem while implementing FailOver in activeMQ.
I have 3 Brokers. Where i have made one Network by enabling
<networkConnectors>
<networkConnector name="Network-Broker"
uri="static:(failover:(tcp://localhost:5001,tcp://localhost:5002)?randomize=false)"
dynamicOnly="true"
networkTTL="3"
duplex="true"/>
</networkConnectors>
and other two are stand alone.
My Network broker is running on 5009 port. I started all the Brokers one by
one(first 5001 then 5002 and then 5009). So as expected the Network Broker
which is running on 5009 is successfully connected to the Broker running on
5001 as i can confirm from the below stack.
INFO | Establishing network connection from vm://amq3 to
failover:(tcp://localhost:5001,tcp://localhost:5002)?randomize=false
INFO | Connector vm://amq3 Started
INFO | Successfully connected to tcp://localhost:5001
INFO | Network Connector Network-Broker Started
I am starting My Application which will create One producer and consumer by
connecting to the Network Broker which is running on 5009 port.
My requirement is when i stop the Network Broker to which my Application is
connected on 5009 it should try to connect to either Broker on 5001 or 5002
and my Application should not fail. Currently what is happening is, my
Application is trying to connect to the Broker reconnect to 5009 port which
is not available , so it is keep on trying. Is it possible that as i have a
Network of Broker(5009 , 5001 , 5002) My application will reconnect to
either 5001 or 5002 ?
I am not sure if "what i am looking for is supported or not". If i have
understood the concept of FailOver then please correct me.
But this is my requirement. If you can suggest a better approach i will be
more happy to see that.
Thanks in advance
--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2537292.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Failover problem
Posted by activeMqUser <ma...@connectm.com>.
Hi Johan,
i have not changed any thing in the configuration for data storage.So by
default it might be taking Memory for storing any data.
I simply used the failover in config file as follows? Is there any thing
else i should do or take care for failover?
<networkConnectors>
<networkConnector name="Network-Broker"
uri="static:(failover:(tcp://localhost:5001,tcp://localhost:5002)?randomize=false)"
dynamicOnly="true"
networkTTL="3"
duplex="true"/>
</networkConnectors>
--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2539964.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Failover problem
Posted by Johan Edstrom <se...@gmail.com>.
How did you setup failover?
Did you test that the brokers actually lock on either a file/memory/db-table?
Visually - the DB setup is the easiest to see, you'll see a table lock in effect on the slave broker
and that it is not starting.
Are you possibly confusing persistence with HA?
The two while useful together are not the same.
I.e
1 : - You want to test and setup Master/Slave
2 : - You want to investigate persistence, - this is not clustering, it is per broker save to a media.
Then you want to match this to your client / usage topology and see if it is enough to meet your needs.
If it is not and you want more "brokers" you want to look at a network of brokers.
/je
On Sep 14, 2010, at 11:01 PM, activeMqUser wrote:
>
> Hi Johan,
>
> i have set up the clients for fail over as i mentioned in the previous posts
> even though i am not sure if i have done it correctly as i am very much a
> new user of ActiveMQ. I have posted the network configuration info and some
> log info also which shows the Main Broker is successfully connecting to one
> of other two Broker on start up and the bridge is successfully established
> between the Brokers in my previous request. Is there anything else i need to
> do? If yes please let me know about that.
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2539947.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Johan Edstrom
joed@opennms.org
They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin, Historical Review of Pennsylvania, 1759
Re: Failover problem
Posted by activeMqUser <ma...@connectm.com>.
Hi Johan,
i have set up the clients for fail over as i mentioned in the previous posts
even though i am not sure if i have done it correctly as i am very much a
new user of ActiveMQ. I have posted the network configuration info and some
log info also which shows the Main Broker is successfully connecting to one
of other two Broker on start up and the bridge is successfully established
between the Brokers in my previous request. Is there anything else i need to
do? If yes please let me know about that.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2539947.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Failover problem
Posted by Johan Edstrom <se...@gmail.com>.
Did you setup the clients to have failover capabilities?
On Sep 14, 2010, at 10:48 PM, activeMqUser wrote:
>
> Yes it failed means, i am facing the above problem and the fail over is not
> happening it seems. I have 3 Brokers running in 3 different port. On failure
> of one broker(main broker) My Consumer which was initially connected to Main
> Broker is not able to switch to other Brokers. It is still keep on looking
> for the Main Broker only.
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2539937.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Johan Edstrom
joed@opennms.org
They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin, Historical Review of Pennsylvania, 1759
Re: Failover problem
Posted by activeMqUser <ma...@connectm.com>.
Yes it failed means, i am facing the above problem and the fail over is not
happening it seems. I have 3 Brokers running in 3 different port. On failure
of one broker(main broker) My Consumer which was initially connected to Main
Broker is not able to switch to other Brokers. It is still keep on looking
for the Main Broker only.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2539937.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Failover problem
Posted by Johan Edstrom <se...@gmail.com>.
Did it fail?
On Sep 14, 2010, at 10:35 PM, activeMqUser wrote:
>
> Hello,
>
> Can i get any help regarding this fail over problem?
>
> Its very urgent for me. Plz dont mind.
>
>
> Thanks
> Manoranjan
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2539929.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Johan Edstrom
joed@opennms.org
They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin, Historical Review of Pennsylvania, 1759
Re: Failover problem
Posted by activeMqUser <ma...@connectm.com>.
Hello,
Can i get any help regarding this fail over problem?
Its very urgent for me. Plz dont mind.
Thanks
Manoranjan
--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2539929.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Failover problem
Posted by activeMqUser <ma...@connectm.com>.
Hi Dejan,
thanks again for ur quick reply.
the url is : INFO: Connecting to URL : tcp://localhost:5009 with "root" as
username and password. Its always the same tcp://localhost:5009 and on
failure it is also trying to connect to the same address but unable to
connect as the Broker is shut down.
Thanks
Manoranjan
--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2537803.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Failover problem
Posted by Dejan Bosanac <de...@nighttale.net>.
MainClass.url is what is important. What;s the url you're using to
connect to the brokers?
Cheers
--
Dejan Bosanac - http://twitter.com/dejanb
Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Mon, Sep 13, 2010 at 2:47 PM, activeMqUser
<ma...@connectm.com> wrote:
>
> Hi Dejan,
>
> Thanks for your quick reply. Connection url i didnt get it properly, but i
> am opening the JMS connection as following.
>
> public static Connection openJMSConnection()
> {
> isActiveMQRunning = false;
> ActiveMQConnectionFactory connectionFactory = null;
> Connection connection = null;
> int count = 0;
> // If unable to open the jmsConnection keep on trying untill success.
> while (!isActiveMQRunning)
> {
> try
> {
> log.info("Connecting to URL : " + MainClass.url + "\t" +
> MainClass.userId + "\t" + MainClass.password);
> // Create a ActiveMQConnectionFactory object.
> connectionFactory = new ActiveMQConnectionFactory(MainClass.userId,
> MainClass.password, MainClass.url);
> // Create a logicalAlarmConnection.
> connection = connectionFactory.createConnection();
> isActiveMQRunning = true;
>
> }
> catch (Exception e)
> {
> count++;
> InetAddress inet = null;
> if (count == 1)
> {
> try
> {
> inet = InetAddress.getLocalHost();
> }
> catch (Exception ex)
> {
> log.error("Error while getting ip address of System.. " + ex);
> }
>
> log.fatal("ActiveMQ Server is down... on " + inet + " machine");
> }
> else
> {
> log.error("Unable to open Connection. ActiveMQ Server is down... ");
> }
> isActiveMQRunning = false;
> }
> }
> return connection;
> }
>
> If this is not enough to understand please let me know.
>
> Thanks
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2537354.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Re: Failover problem
Posted by activeMqUser <ma...@connectm.com>.
Hi Dejan,
Thanks for your quick reply. Connection url i didnt get it properly, but i
am opening the JMS connection as following.
public static Connection openJMSConnection()
{
isActiveMQRunning = false;
ActiveMQConnectionFactory connectionFactory = null;
Connection connection = null;
int count = 0;
// If unable to open the jmsConnection keep on trying untill success.
while (!isActiveMQRunning)
{
try
{
log.info("Connecting to URL : " + MainClass.url + "\t" +
MainClass.userId + "\t" + MainClass.password);
// Create a ActiveMQConnectionFactory object.
connectionFactory = new ActiveMQConnectionFactory(MainClass.userId,
MainClass.password, MainClass.url);
// Create a logicalAlarmConnection.
connection = connectionFactory.createConnection();
isActiveMQRunning = true;
}
catch (Exception e)
{
count++;
InetAddress inet = null;
if (count == 1)
{
try
{
inet = InetAddress.getLocalHost();
}
catch (Exception ex)
{
log.error("Error while getting ip address of System.. " + ex);
}
log.fatal("ActiveMQ Server is down... on " + inet + " machine");
}
else
{
log.error("Unable to open Connection. ActiveMQ Server is down... ");
}
isActiveMQRunning = false;
}
}
return connection;
}
If this is not enough to understand please let me know.
Thanks
--
View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2537354.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Failover problem
Posted by Dejan Bosanac <de...@nighttale.net>.
What is a connection url you're using?
Cheers
--
Dejan Bosanac - http://twitter.com/dejanb
Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Mon, Sep 13, 2010 at 1:56 PM, activeMqUser
<ma...@connectm.com> wrote:
>
> Hello,
>
> i am facing a problem while implementing FailOver in activeMQ.
> I have 3 Brokers. Where i have made one Network by enabling
>
> <networkConnectors>
> <networkConnector name="Network-Broker"
>
> uri="static:(failover:(tcp://localhost:5001,tcp://localhost:5002)?randomize=false)"
> dynamicOnly="true"
> networkTTL="3"
> duplex="true"/>
> </networkConnectors>
>
> and other two are stand alone.
>
> My Network broker is running on 5009 port. I started all the Brokers one by
> one(first 5001 then 5002 and then 5009). So as expected the Network Broker
> which is running on 5009 is successfully connected to the Broker running on
> 5001 as i can confirm from the below stack.
>
> INFO | Establishing network connection from vm://amq3 to
> failover:(tcp://localhost:5001,tcp://localhost:5002)?randomize=false
> INFO | Connector vm://amq3 Started
> INFO | Successfully connected to tcp://localhost:5001
> INFO | Network Connector Network-Broker Started
>
> I am starting My Application which will create One producer and consumer by
> connecting to the Network Broker which is running on 5009 port.
> My requirement is when i stop the Network Broker to which my Application is
> connected on 5009 it should try to connect to either Broker on 5001 or 5002
> and my Application should not fail. Currently what is happening is, my
> Application is trying to connect to the Broker reconnect to 5009 port which
> is not available , so it is keep on trying. Is it possible that as i have a
> Network of Broker(5009 , 5001 , 5002) My application will reconnect to
> either 5001 or 5002 ?
>
> I am not sure if "what i am looking for is supported or not". If i have
> understood the concept of FailOver then please correct me.
>
> But this is my requirement. If you can suggest a better approach i will be
> more happy to see that.
>
> Thanks in advance
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2537292.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>