powered by Jive Software

Issue in Setting up a load Balancer in front of openfire cluster

Hi All,

I am trying to set up a load balancer(HAProxy) in front of openfire cluster but I am stuck in configuring the load balancer tool.

Below is my set up:

  1. Two openfire (3_7_1) servers in cluster sharing one centralized MYQSL.

  2. Oracle coherence framework and openfire clustering plug-in is used to establish openfire cluster.

  3. Trying to use HAProxy as load balancer ( I have configured XMPP servers in HAProxy config file)

  4. Smack client API to connect server.

  5. cluster is working fine.

please let me know how smack code can talk to load balancer and load balancer can forward the request to XMPP servers.

How to configure xmpp domain name in code and connect some user through smack api code. I am not using any xmpp client such as pidgin etc… i am writing my own client by using smack API.

Quick repose very much appreciated.

Regards,

Guru

I’ve never tried using HAProxy for XMPP load balancing - We utilizing LVS/ldirectord with custom Perl scripts to monitor XMPP services, which has ended up to be pretty reliable.

You need to talk to the IP assigned to your load balancer from your client - You might be better off validating it all using an existing client with good debug information (Pidgin or Spark, or even XMPPHP) to make sure it is working.

The load balancer should end up being totally transparent, other than you needing to use a different ip/host to connect to it with (or setup a SRV record for it).

Hi Guru, not to hijack your thread… I been trying to get Clustering setup for a while, but with 3.7.0 and 3.7.1, both on windows and Linux, and been running to a lot of issues. Looking through the boards, you seem to be the one of the few that got it work.

Do you mind sharing info on how you set it up? Operating System, Java version, etc…?

Thanks!

I run Openfire 3.7.1 on 64bit RHEL6 using JRE 1.6u32 with Coherence 3.3.1 and the 1.2.1_beta Clustering plugin.

What steps did you take to make it work? I have gone through the forums quite a few times, tyring to piece together what are the steps to make Clustering work correctly, but seems like I am still missing something.

I had placed tangosol-coherence-override.xml in the root and placed coherence-cache-config.xml inside coherence.jar and inside the lib directory. Still, cannot get it all working.

Help is greatly appriciated!

Well, what specifically is not working? if you search the support forums, there are lots of threads from people who have it setup and working - Look at my historic posts, as I reference them many times.

Post some errors and what isn’t working and maybe we can figure it out.

Sure thing,

This is the error I hit:

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:169)

at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:602 )

at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:689)

at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:667)

at com.jivesoftware.util.cache.CoherenceClusteredCacheFactory.startCluster(Coheren ceClusteredCacheFactory.java:110)

at org.jivesoftware.util.cache.CacheFactory.startClustering(CacheFactory.java:580)

at org.jivesoftware.openfire.cluster.ClusterManager.startup(ClusterManager.java:27 0)

at org.jivesoftware.openfire.cluster.ClusterManager.setClusteringEnabled(ClusterMa nager.java:320)

Seems to be in this line in the plugin:

com.tangosol.net.CacheFactory.getCache(“opt-$cacheStats”);

I have seen this error being reported here, but I have not seen a solution to the problem.

Thanks!

You’re missing the beginning of the stack trace. Can you post it all?

Sure thing,

line
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:602 )
at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:689)
at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:667)
at com.jivesoftware.util.cache.CoherenceClusteredCacheFactory.startCluster(Coheren ceClusteredCacheFactory.java:110)
at org.jivesoftware.util.cache.CacheFactory.startClustering(CacheFactory.java:580)
at org.jivesoftware.openfire.cluster.ClusterManager.startup(ClusterManager.java:27 0)
at org.jivesoftware.openfire.cluster.ClusterManager.setClusteringEnabled(ClusterMa nager.java:320)
at org.apache.jsp.system_002dclustering_jsp._jspService(system_002dclustering_jsp. java:136)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:530)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1216)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:11 8)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1187)
at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:74)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1187)
at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingF ilter.java:50)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1187)
at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:78)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1187)
at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:164)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1187)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:425)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:494)
at org.eclipse.jetty.server.session.SessionHandler.handle(SessionHandler.java:182)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:93 3)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:362)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:867 )
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandler Collection.java:245)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.jav a:126)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
at org.eclipse.jetty.server.Server.handle(Server.java:334)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.j ava:1007)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:747)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:4 62)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
at java.lang.Thread.run(Thread.java:662)

You’re still missing the useful part - What’s at lines 1-8?

blarg, missed that one

java.lang.ClassNotFoundException: com.jivesoftware.util.cache.JiveConfigurableCacheFactory

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:169)

at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:602 )

at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:689)

at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:667)

Which clustering plugin are you using, and what version of coherence do you have?

Using clustering 1.2.1_beta

Using coherence 3.3

ok, got it working. See this post

cheers!

Hi David,

I understand that you can load balanced openfire servers using LVS/Ldirectored which acts as an IP based loadbalancer. The perl scripts you are taking about monitors the health of the actual openfire servers.

Could you please let me know how the custom perl scripts work?

What does the perl script exactly do and is there a way to pass parameters to the custom perl script.

I am new to loadbalancing servers. kindly help.

Perl script basically takes hostname and port as arguments, then attempts to connect and authenticate to the XMPP services running on that host/port using a pre-defined username and password.

Probably simpler if you just start with your check doing a tcp connection to port 5222 on each backend system and making sure that works, then doing deeper application checks later.