-
1. Re: HornetQ Clustering
ekfliu Sep 1, 2011 1:09 PM (in response to michaelbini)1 of 1 people found this helpfulHornetq does not have a traditional clustered queue. But can be configured to act similarily to one.
What you can do is have client side load-balancing. Mean the hornetq client knows about the 2 servers and itself round robin the messages between the servers.
Another way is to configure a cluster connection between the two servers. This where a Core Bridge is automatically configured for you to redistribute message between the servers with same name queues. This way a client can have knowledge of one server send all message to that server and the cluster core bridge would take message from it and forward to the second server.
This is just for load balancing, HA and fail over has completely different configuration involved.
-
2. Re: HornetQ Clustering
michaelbini Sep 2, 2011 5:20 AM (in response to ekfliu)Thank's for your answer,
can you explain more about the second method(A link about it will be fine)
noe more question is how do i send message to this server :
"run.bat -c nodeB -Djboss.service.binding.set=ports-01 -Djboss.messaging.ServerPeerID=2"
I try this -
------------------
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "localhost:2099");
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
context = new InitialContext(p);
-----------------
But still the first server is receving the message, am I doing something wrong ?
-
3. Re: HornetQ Clustering
ekfliu Sep 2, 2011 10:34 AM (in response to michaelbini)First the -Djboss.messaging.ServerPeerID=2 is not used by hornetq, that was used in the original jboss messaging on 5.1. The server id configuration in hornetq is only used if you have multiple hornetq servers running in the same jvm or maybe machine, not sure which.
Second the hornetq uses ipaddress to connect between servers(at least message broker does), that mean you cannot use bind address of 0.0.0.0 or localhost starting the jboss server. So if you configure the hornetq to start using the same jboss.bind.address and you start with 0.0.0.0 that wont work. You can either configure the hornetq bind address as a separate environment variable or change the jboss.bind.address to real ip address. Keep in mind localhost access will no longer work if you do the latter.
http://docs.jboss.org/hornetq/2.2.5.Final/user-manual/en/html/clusters.html#d0e10168
This will help you with cluster connection for message redistribution with cluster.
Message redistribution with queues.
http://docs.jboss.org/hornetq/2.2.5.Final/user-manual/en/html/clusters.html#d0e10395
If you have low number of server you can manually specify the cluster servers yourself.
I also recommend you download the source code to hornetq, they have examples configuration. You just need to combine static cluster example with message redistribution example and you're good to go.