You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "andy boot (JIRA)" <ji...@apache.org> on 2011/03/31 17:36:06 UTC
[jira] [Created] (AMQ-3256) For a Master Slave failover broker
setup. The system does not reconnect to the broker if the brokers are
restarted
For a Master Slave failover broker setup. The system does not reconnect to the broker if the brokers are restarted
------------------------------------------------------------------------------------------------------------------
Key: AMQ-3256
URL: https://issues.apache.org/jira/browse/AMQ-3256
Project: ActiveMQ
Issue Type: Bug
Components: Broker
Affects Versions: 5.4.2
Environment: Windows XP
Reporter: andy boot
Start a Master & Slave broker.
Connect to them with failover=true and randomize=false
Message Sending - ok.
Kill the Master broker.
Message Sending - ok.
Kill the Slave broker.
Message Sending - paused (both brokers are down)
Restart both brokers.
Message Sending - fail.
The above WORKS in ActiveMQ 5.3.1 but fails in 5.4.2
I wonder if this is related to: https://issues.apache.org/jira/browse/AMQ-3213
Steps to reproduce the problem:
* Run Broker, BrokerSlave, Client, Server,
* Note messages being sent from Server to Client
* Kill Broker
* Note messages being sent from Server to Client
* Kill BrokerSlave
* Restart Broker & BrokerSlave,
* Messages no longer being sent.
{code:title=Broker.java|borderStyle=solid}
public class Broker {
public static void main(String[] args) throws Exception {
BrokerService broker;
broker = BrokerFactory.createBroker("xbean:master.xml");
broker.start();
while(true) {
Thread.sleep(10*1000);
}
}
}
{code}
{code:title=BrokerSlave.java|borderStyle=solid}
public class BrokerSlave {
public static void main(String[] args) throws Exception {
BrokerService broker;
broker = BrokerFactory.createBroker("xbean:slave.xml");
broker.start();
while(true) {
Thread.sleep(10*1000);
}
}
}
{code}
{code:title=Client.java|borderStyle=solid}
public class Client {
static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
static String user = null;
static String password = null;
public static void main(String[] args) throws JMSException, InterruptedException {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
final Connection connection = connectionFactory.createConnection();
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
final Queue orderQueue = session.createQueue("VendorOrderQueue");
final MessageConsumer consumer = session.createConsumer(orderQueue);
consumer.setMessageListener(new MsgL() );
session.run();
connection.start();
while(true) {
Thread.sleep(5000);
}
}
private static class MsgL implements MessageListener {
public void onMessage(final Message message) {
System.out.println("Got message: "+message);
}
}
}
{code}
{code:title=Server.java|borderStyle=solid}
public class Server {
static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
static String user = null;
static String password = null;
public static void main(String[] args) throws JMSException, InterruptedException {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
final Connection connection = connectionFactory.createConnection();
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
final Queue orderQueue = session.createQueue("VendorOrderQueue");
final MessageProducer producer = session.createProducer(orderQueue);
session.run();
connection.start();
for (int i = 0; i < 100; i++) {
MapMessage message = session.createMapMessage();
message.setString("Item", "hello "+i);
System.out.println("Sending: "+message);
producer.send(message);
System.out.println("Wait for 5s");
Thread.sleep(5000);
}
}
}
{code}
{code:title=master.xml|borderStyle=solid}
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<broker xmlns="http://activemq.apache.org/schema/core"
persistent="false"
waitForSlave="true"
useJmx="true">
<transportConnectors>
<transportConnector uri="tcp://localhost:61616"/>
</transportConnectors>
</broker>
</beans>
{code}
{code:title=slave.xml|borderStyle=solid}
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<broker xmlns="http://activemq.apache.org/schema/core"
persistent="false"
useJmx="false"
shutdownOnMasterFailure="false">
<services>
<masterConnector remoteURI="tcp://localhost:61616"/>
</services>
<transportConnectors>
<transportConnector uri="tcp://localhost:61617"/>
</transportConnectors>
</broker>
</beans>
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (AMQ-3256) For a Master Slave failover broker
setup. The system does not reconnect to the broker if the brokers are
restarted
Posted by "Amit Bohra (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AMQ-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014442#comment-13014442 ]
Amit Bohra commented on AMQ-3256:
---------------------------------
I also faced the similar problem. Here are the steps for the same:
1. Failover setup using JDBC MySQL
2. Start master and slave
3. Send messages - (success)
4. Stop master
5. Send messages - (success, as slave has picked them up)
6. Restart master and stop slave
7. Send messages - (hung, clients waiting for connection)
> For a Master Slave failover broker setup. The system does not reconnect to the broker if the brokers are restarted
> ------------------------------------------------------------------------------------------------------------------
>
> Key: AMQ-3256
> URL: https://issues.apache.org/jira/browse/AMQ-3256
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.4.2
> Environment: Windows XP
> Reporter: andy boot
> Labels: failover
>
> Start a Master & Slave broker.
> Connect to them with failover=true and randomize=false
> Message Sending - ok.
> Kill the Master broker.
> Message Sending - ok.
> Kill the Slave broker.
> Message Sending - paused (both brokers are down)
> Restart both brokers.
> Message Sending - fail.
> The above WORKS in ActiveMQ 5.3.1 but fails in 5.4.2
> I wonder if this is related to: https://issues.apache.org/jira/browse/AMQ-3213
> Steps to reproduce the problem:
> * Run Broker, BrokerSlave, Client, Server,
> * Note messages being sent from Server to Client
> * Kill Broker
> * Note messages being sent from Server to Client
> * Kill BrokerSlave
> * Restart Broker & BrokerSlave,
> * Messages no longer being sent.
> {code:title=Broker.java|borderStyle=solid}
> public class Broker {
> public static void main(String[] args) throws Exception {
> BrokerService broker;
> broker = BrokerFactory.createBroker("xbean:master.xml");
> broker.start();
> while(true) {
> Thread.sleep(10*1000);
> }
> }
> }
> {code}
> {code:title=BrokerSlave.java|borderStyle=solid}
> public class BrokerSlave {
> public static void main(String[] args) throws Exception {
> BrokerService broker;
> broker = BrokerFactory.createBroker("xbean:slave.xml");
> broker.start();
> while(true) {
> Thread.sleep(10*1000);
> }
> }
> }
> {code}
> {code:title=Client.java|borderStyle=solid}
> public class Client {
> static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
> static String user = null;
> static String password = null;
> public static void main(String[] args) throws JMSException, InterruptedException {
> ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
> final Connection connection = connectionFactory.createConnection();
> final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> final Queue orderQueue = session.createQueue("VendorOrderQueue");
> final MessageConsumer consumer = session.createConsumer(orderQueue);
> consumer.setMessageListener(new MsgL() );
> session.run();
> connection.start();
> while(true) {
> Thread.sleep(5000);
> }
> }
> private static class MsgL implements MessageListener {
> public void onMessage(final Message message) {
> System.out.println("Got message: "+message);
> }
> }
> }
> {code}
> {code:title=Server.java|borderStyle=solid}
> public class Server {
> static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
> static String user = null;
> static String password = null;
> public static void main(String[] args) throws JMSException, InterruptedException {
> ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
> final Connection connection = connectionFactory.createConnection();
> final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> final Queue orderQueue = session.createQueue("VendorOrderQueue");
> final MessageProducer producer = session.createProducer(orderQueue);
> session.run();
> connection.start();
> for (int i = 0; i < 100; i++) {
> MapMessage message = session.createMapMessage();
> message.setString("Item", "hello "+i);
> System.out.println("Sending: "+message);
> producer.send(message);
> System.out.println("Wait for 5s");
> Thread.sleep(5000);
> }
> }
> }
> {code}
> {code:title=master.xml|borderStyle=solid}
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> <broker xmlns="http://activemq.apache.org/schema/core"
> persistent="false"
> waitForSlave="true"
> useJmx="true">
> <transportConnectors>
> <transportConnector uri="tcp://localhost:61616"/>
> </transportConnectors>
> </broker>
> </beans>
> {code}
> {code:title=slave.xml|borderStyle=solid}
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> <broker xmlns="http://activemq.apache.org/schema/core"
> persistent="false"
> useJmx="false"
> shutdownOnMasterFailure="false">
> <services>
> <masterConnector remoteURI="tcp://localhost:61616"/>
> </services>
> <transportConnectors>
> <transportConnector uri="tcp://localhost:61617"/>
> </transportConnectors>
> </broker>
> </beans>
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (AMQ-3256) For a Master Slave failover broker
setup. The system does not reconnect to the broker if the brokers are
restarted
Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AMQ-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timothy Bish closed AMQ-3256.
-----------------------------
Resolution: Cannot Reproduce
We have numerous test cases covering scenarios like this which are all working without issue. Recommend you upgrade to a newer release such as v5.7.0.
> For a Master Slave failover broker setup. The system does not reconnect to the broker if the brokers are restarted
> ------------------------------------------------------------------------------------------------------------------
>
> Key: AMQ-3256
> URL: https://issues.apache.org/jira/browse/AMQ-3256
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.4.2
> Environment: Windows XP
> Reporter: andy boot
> Labels: failover
>
> Start a Master & Slave broker.
> Connect to them with failover=true and randomize=false
> Message Sending - ok.
> Kill the Master broker.
> Message Sending - ok.
> Kill the Slave broker.
> Message Sending - paused (both brokers are down)
> Restart both brokers.
> Message Sending - fail.
> The above WORKS in ActiveMQ 5.3.1 but fails in 5.4.2
> I wonder if this is related to: https://issues.apache.org/jira/browse/AMQ-3213
> Steps to reproduce the problem:
> * Run Broker, BrokerSlave, Client, Server,
> * Note messages being sent from Server to Client
> * Kill Broker
> * Note messages being sent from Server to Client
> * Kill BrokerSlave
> * Restart Broker & BrokerSlave,
> * Messages no longer being sent.
> {code:title=Broker.java|borderStyle=solid}
> public class Broker {
> public static void main(String[] args) throws Exception {
> BrokerService broker;
> broker = BrokerFactory.createBroker("xbean:master.xml");
> broker.start();
> while(true) {
> Thread.sleep(10*1000);
> }
> }
> }
> {code}
> {code:title=BrokerSlave.java|borderStyle=solid}
> public class BrokerSlave {
> public static void main(String[] args) throws Exception {
> BrokerService broker;
> broker = BrokerFactory.createBroker("xbean:slave.xml");
> broker.start();
> while(true) {
> Thread.sleep(10*1000);
> }
> }
> }
> {code}
> {code:title=Client.java|borderStyle=solid}
> public class Client {
> static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
> static String user = null;
> static String password = null;
> public static void main(String[] args) throws JMSException, InterruptedException {
> ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
> final Connection connection = connectionFactory.createConnection();
> final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> final Queue orderQueue = session.createQueue("VendorOrderQueue");
> final MessageConsumer consumer = session.createConsumer(orderQueue);
> consumer.setMessageListener(new MsgL() );
> session.run();
> connection.start();
> while(true) {
> Thread.sleep(5000);
> }
> }
> private static class MsgL implements MessageListener {
> public void onMessage(final Message message) {
> System.out.println("Got message: "+message);
> }
> }
> }
> {code}
> {code:title=Server.java|borderStyle=solid}
> public class Server {
> static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
> static String user = null;
> static String password = null;
> public static void main(String[] args) throws JMSException, InterruptedException {
> ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
> final Connection connection = connectionFactory.createConnection();
> final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> final Queue orderQueue = session.createQueue("VendorOrderQueue");
> final MessageProducer producer = session.createProducer(orderQueue);
> session.run();
> connection.start();
> for (int i = 0; i < 100; i++) {
> MapMessage message = session.createMapMessage();
> message.setString("Item", "hello "+i);
> System.out.println("Sending: "+message);
> producer.send(message);
> System.out.println("Wait for 5s");
> Thread.sleep(5000);
> }
> }
> }
> {code}
> {code:title=master.xml|borderStyle=solid}
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> <broker xmlns="http://activemq.apache.org/schema/core"
> persistent="false"
> waitForSlave="true"
> useJmx="true">
> <transportConnectors>
> <transportConnector uri="tcp://localhost:61616"/>
> </transportConnectors>
> </broker>
> </beans>
> {code}
> {code:title=slave.xml|borderStyle=solid}
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> <broker xmlns="http://activemq.apache.org/schema/core"
> persistent="false"
> useJmx="false"
> shutdownOnMasterFailure="false">
> <services>
> <masterConnector remoteURI="tcp://localhost:61616"/>
> </services>
> <transportConnectors>
> <transportConnector uri="tcp://localhost:61617"/>
> </transportConnectors>
> </broker>
> </beans>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (AMQ-3256) For a Master Slave failover broker
setup. The system does not reconnect to the broker if the brokers are
restarted
Posted by "andy boot (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AMQ-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014506#comment-13014506 ]
andy boot commented on AMQ-3256:
--------------------------------
I realise this is a dirty hack and I haven't thought thru the implications but opening class FailoverTransport and commenting out line 1044 " this.uris.remove(uri);" in method "updateURIs()" appears to make it work.
> For a Master Slave failover broker setup. The system does not reconnect to the broker if the brokers are restarted
> ------------------------------------------------------------------------------------------------------------------
>
> Key: AMQ-3256
> URL: https://issues.apache.org/jira/browse/AMQ-3256
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker
> Affects Versions: 5.4.2
> Environment: Windows XP
> Reporter: andy boot
> Labels: failover
>
> Start a Master & Slave broker.
> Connect to them with failover=true and randomize=false
> Message Sending - ok.
> Kill the Master broker.
> Message Sending - ok.
> Kill the Slave broker.
> Message Sending - paused (both brokers are down)
> Restart both brokers.
> Message Sending - fail.
> The above WORKS in ActiveMQ 5.3.1 but fails in 5.4.2
> I wonder if this is related to: https://issues.apache.org/jira/browse/AMQ-3213
> Steps to reproduce the problem:
> * Run Broker, BrokerSlave, Client, Server,
> * Note messages being sent from Server to Client
> * Kill Broker
> * Note messages being sent from Server to Client
> * Kill BrokerSlave
> * Restart Broker & BrokerSlave,
> * Messages no longer being sent.
> {code:title=Broker.java|borderStyle=solid}
> public class Broker {
> public static void main(String[] args) throws Exception {
> BrokerService broker;
> broker = BrokerFactory.createBroker("xbean:master.xml");
> broker.start();
> while(true) {
> Thread.sleep(10*1000);
> }
> }
> }
> {code}
> {code:title=BrokerSlave.java|borderStyle=solid}
> public class BrokerSlave {
> public static void main(String[] args) throws Exception {
> BrokerService broker;
> broker = BrokerFactory.createBroker("xbean:slave.xml");
> broker.start();
> while(true) {
> Thread.sleep(10*1000);
> }
> }
> }
> {code}
> {code:title=Client.java|borderStyle=solid}
> public class Client {
> static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
> static String user = null;
> static String password = null;
> public static void main(String[] args) throws JMSException, InterruptedException {
> ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
> final Connection connection = connectionFactory.createConnection();
> final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> final Queue orderQueue = session.createQueue("VendorOrderQueue");
> final MessageConsumer consumer = session.createConsumer(orderQueue);
> consumer.setMessageListener(new MsgL() );
> session.run();
> connection.start();
> while(true) {
> Thread.sleep(5000);
> }
> }
> private static class MsgL implements MessageListener {
> public void onMessage(final Message message) {
> System.out.println("Got message: "+message);
> }
> }
> }
> {code}
> {code:title=Server.java|borderStyle=solid}
> public class Server {
> static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false";
> static String user = null;
> static String password = null;
> public static void main(String[] args) throws JMSException, InterruptedException {
> ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
> final Connection connection = connectionFactory.createConnection();
> final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
> final Queue orderQueue = session.createQueue("VendorOrderQueue");
> final MessageProducer producer = session.createProducer(orderQueue);
> session.run();
> connection.start();
> for (int i = 0; i < 100; i++) {
> MapMessage message = session.createMapMessage();
> message.setString("Item", "hello "+i);
> System.out.println("Sending: "+message);
> producer.send(message);
> System.out.println("Wait for 5s");
> Thread.sleep(5000);
> }
> }
> }
> {code}
> {code:title=master.xml|borderStyle=solid}
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> <broker xmlns="http://activemq.apache.org/schema/core"
> persistent="false"
> waitForSlave="true"
> useJmx="true">
> <transportConnectors>
> <transportConnector uri="tcp://localhost:61616"/>
> </transportConnectors>
> </broker>
> </beans>
> {code}
> {code:title=slave.xml|borderStyle=solid}
> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
> <broker xmlns="http://activemq.apache.org/schema/core"
> persistent="false"
> useJmx="false"
> shutdownOnMasterFailure="false">
> <services>
> <masterConnector remoteURI="tcp://localhost:61616"/>
> </services>
> <transportConnectors>
> <transportConnector uri="tcp://localhost:61617"/>
> </transportConnectors>
> </broker>
> </beans>
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira