Hi Tim
Thank you so much.
With the following configuration, it works very well.
on server 10.80.1.1, add the networkConnectors as the following:
<networkConnectors>
<networkConnector
uri="static:(tcp://10.80.1.2:61616,tcp://10.80.1.3:61616)"/>
</networkConnectors>
on server 10.80.1.2, add the networkConnectors as the following:
<networkConnectors>
<networkConnector
uri="static:(tcp://10.80.1.1:61616,tcp://10.80.1.3:61616)"/>
</networkConnectors>
on server 10.80.1.3, add the networkConnectors as the following:
<networkConnectors>
<networkConnector
uri="static:(tcp://10.80.1.1:61616,tcp://10.80.1.2:61616)"/>
</networkConnectors>
and add the three servers to HAProxy, as the following:
frontend mqtt_proxy
bind *:1883
mode tcp
default_backend mqtt_agent
backend mqtt_agent
mode tcp
option tcplog
balance roundrobin
server mqtt_01 10.80.1.1:1883 check
server mqtt_02 10.80.1.2:1883 check
server mqtt_03 10.80.1.3:1883 check
It works well as a cluster of mqtt brokers.
Thank you very much again.
Wang
On 2015年09月02日 00:26, Tim Bain wrote:
In that case, you'll want each broker connected simultaneously to both the
other two brokers (but not to themselves!), using the static transport
instead of masterslave (which is really just syntactic sugar for failover,
resulting in a connection to only one of the N underlying URIs). The
easiest option is to have have each broker make non-duplex connections to
all other brokers, though you can do it with duplex connections with a
little more effort; just make sure you don't make two duplex connections,
one from each side.
On Sep 1, 2015 8:18 AM, "wang" <w...@kai.co.jp> wrote:
Hi Tim
Thanks for you quick reply.
What I am trying is to look for a network of brokers (where all brokers
are active and forward messages to each other to reach consumers connected
to the other brokers, and where messages may be delivered out of order
compared to when they were sent). But I donot know how to configure a
network of brokers, so I tried to use master/slave configure.
I want a network of brokers working with load balancer with single
outside IP address.
Thanks,
Wang
On 2015年09月01日 23:05, Tim Bain wrote:
Are you trying to have a master/slave cluster (where only one broker is
active and the others are backups, and where message ordering is
consistent), or are you looking for a network of brokers (where all brokers
are active and forward messages to each other to reach consumers connected
to the other brokers, and where messages may be delivered out of order
compared to when they were sent)? Your path forward depends on which
you're doing, so let's be sure we're clear on that before we go any further.
On Sep 1, 2015 7:13 AM, "wang" <w...@kai.co.jp <mailto:w...@kai.co.jp>>
wrote:
Hi Tim
Thanks for you answer.
I m trying to accomplish here is because I want to put the three
brokers behind a load balancer. So if one broker down, the others
could server well.
I read from here
http://activemq.apache.org/networks-of-brokers.html
on that page it said as the following about MasterSlave Discovery
The URIs are listed in order for:
MASTER,SLAVE1,SLAVE2...SLAVE(thumbs down)
The same configuration options for|static:|are available
for|masterslave:
so I just to put the networkConnector uri to just 10.80.1.1, and
leave the other 2 and 3 as default configuration.
|
|Now, I using put the following configure to all the activeMQ
instances, and now it works fine, I used HAProxy to serve as load
balancer. Just set dulplex as true and using 61616 not 1883
|
|
<networkConnectors>
<networkConnector duplex="true"
uri="masterslave:(tcp://10.80.1.1:61616
<http://10.80.1.1:61616>,tcp://10.80.1.2:61616
<http://10.80.1.2:61616>,tcp://10.80.1.3:61616
<http://10.80.1.3:61616>)"/>
</networkConnectors>
|
Anyway, it works fine now. Although there is an error like the
following. "prsence" is a topic I added using web console
the error log as the followings:
WARN | Failed to register topic://presence
javax.management.InstanceAlreadyExistsException:
org.apache.activemq:brokerName=10.80.1.3,connector=networkConnectors,networkConnectorName=NC,networkBridge=tcp_//10.80.1.1_61616,type=Broker,direction=inbound,destinationType=Topic,destinationName=presence
at
com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)[:1.7.0_79]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)[:1.7.0_79]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)[:1.7.0_79]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)[:1.7.0_79]
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)[:1.7.0_79]
at
com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)[:1.7.0_79]
at
org.apache.activemq.broker.jmx.ManagementContext.registerMBean(ManagementContext.java:408)[activemq-broker-5.12.0.jar:5.12.0]
at
org.apache.activemq.broker.jmx.AnnotatedMBean.registerMBean(AnnotatedMBean.java:72)[activemq-broker-5.12.0.jar:5.12.0]
at
org.apache.activemq.network.MBeanBridgeDestination.onInboundMessage(MBeanBridgeDestination.java:97)[activemq-broker-5.12.0.jar:5.12.0]
at
org.apache.activemq.network.MBeanNetworkListener.onInboundMessage(MBeanNetworkListener.java:115)[activemq-broker-5.12.0.jar:5.12.0]
at
org.apache.activemq.network.DemandForwardingBridgeSupport.serviceInboundMessage(DemandForwardingBridgeSupport.java:1683)[activemq-broker-5.12.0.jar:5.12.0]
at
org.apache.activemq.network.DemandForwardingBridgeSupport.serviceRemoteCommand(DemandForwardingBridgeSupport.java:652)[activemq-broker-5.12.0.jar:5.12.0]
at
org.apache.activemq.network.DemandForwardingBridgeSupport$3.onCommand(DemandForwardingBridgeSupport.java:225)[activemq-broker-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:116)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.failover.FailoverTransport$3.onCommand(FailoverTransport.java:213)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:300)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:214)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)[activemq-client-5.12.0.jar:5.12.0]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
WARN | Transport (tcp://10.80.1.1:61616 <http://10.80.1.1:61616>)
failed, not attempting to automatically reconnect
java.io.EOFException
at
java.io.DataInputStream.readInt(DataInputStream.java:392)[:1.7.0_79]
at
org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:267)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)[activemq-client-5.12.0.jar:5.12.0]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
WARN | Network connection between vm://10.80.1.3#176
<http://10.80.1.3#176> and unconnected shutdown due to a remote
error: java.io.EOFException
INFO | Establishing network connection from
vm://10.80.1.3?async=false <http://10.80.1.3?async=false> to
failover:(tcp://10.80.1.1:61616
<http://10.80.1.1:61616>,tcp://10.80.1.2:61616
<http://10.80.1.2:61616>,tcp://10.80.1.3:61616
)?randomize=false&maxReconnectAttempts=0
INFO | 10.80.1.3 bridge to 10.80.1.1 stopped
INFO | Successfully connected to tcp://10.80.1.1:61616
<http://10.80.1.1:61616>
INFO | Network connection between vm://10.80.1.3#180
<http://10.80.1.3#180> and tcp://10.80.1.1:61616
<http://10.80.1.1:61616> (10.80.1.1) has been established.
Thank you Tim.
Do you know why I got the error above?
Regards,
Wang
On 2015年09月01日 21:42, Tim Bain wrote:
Why have you configured 10.80.1.1 to connect to itself, and why are
2 and 3
default configurations?
More generally, what are you trying to accomplish here?
I assume you've read the content at
http://activemq.apache.org/masterslave.html, but if not, you need
to.
On Sep 1, 2015 3:25 AM, "wang"<w...@kai.co.jp> <mailto:
w...@kai.co.jp> wrote:
Hi guys
I am Wang and I facing problem when i configured MQTT master-slave
using
activeMQ 5.12
I have three servers: 10.80.1.1, 10.80.1.2, 10.80.1.3
I deployed default activeMQ instance onto 10.80.1.2, 10.80.1.3.
And I added the following networkConnectors to server 10.80.1.1 :
<networkConnectors>
<networkConnector uri="masterslave:(tcp://
10.80.1.1:1883 <http://10.80.1.1:1883>
,tcp://10.80.1.2:1883 <http://10.80.1.2:1883>,tcp://10.80.1.3:1883
<http://10.80.1.3:1883>)"/>
</networkConnectors>
I can started server 10.80.1.2 and server 10.80.1.3, but when I try
to
start server 10.80.1.1
I got the following errors:
WARN | Transport Connection to: tcp://10.80.1.1:37442 <
http://10.80.1.1:37442> failed:
org.apache.activemq.transport.InactivityIOException: Channel was
inactive
for too (>60000) long: tcp://10.80.1.1:37442 <
http://10.80.1.1:37442>
INFO | Establishing network connection from vm://
10.80.1.1?async=false <http://10.80.1.1?async=false>
to failover:(tcp://10.80.1.1:1883 <http://10.80.1.1:1883>,tcp://
10.80.1.2:1883 <http://10.80.1.2:1883>
,tcp://10.80.1.3:1883)?randomize=false&maxReconnectAttempts=0
INFO | Connector vm://10.80.1.1 <http://10.80.1.1> started
INFO | Successfully connected to tcp://10.80.1.1:1883 <
http://10.80.1.1:1883>
WARN | Exception occurred processing:
MQTTFrame { type: unknown, qos: AT_MOST_ONCE, dup:false }:
org.apache.activemq.transport.mqtt.MQTTProtocolException: Unknown
MQTTFrame
type: 0
WARN | Transport (tcp://10.80.1.1:1883 <http://10.80.1.1:1883>)
failed, not attempting to
automatically reconnect
java.io.EOFException
at
java.io.DataInputStream.readInt(DataInputStream.java:392)[:1.7.0_79]
at
org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:267)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)[activemq-client-5.12.0.jar:5.12.0]
at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)[activemq-client-5.12.0.jar:5.12.0]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
INFO | Network connection between vm://10.80.1.1#86 <
http://10.80.1.1#86> and unconnected
shutdown due to a local error: java.lang.Throwable:
remoteBrokerInfo is null
INFO | Connector vm://10.80.1.1 <http://10.80.1.1> stopped
INFO | 10.80.1.1 bridge to Unknown stopped
who could give me some hints to solve this problem?
Regards,
Wang
-- *********************
株式会社カイクリエイツ 王 兆強
〒150-0001 東京都渋谷区神宮前5-39-6
TEL : 03-3486-9119
FAX : 03-3486-9800
Mail:w...@kai.co.jp <mailto:w...@kai.co.jp>
*********************
--
*********************
株式会社カイクリエイツ 王 兆強
〒150-0001 東京都渋谷区神宮前5-39-6
TEL : 03-3486-9119
FAX : 03-3486-9800
Mail: w...@kai.co.jp
*********************
--
*********************
株式会社カイクリエイツ 王 兆強
〒150-0001 東京都渋谷区神宮前5-39-6
TEL : 03-3486-9119
FAX : 03-3486-9800
Mail: w...@kai.co.jp
*********************