Skip to main content
Skip table of contents

Configuring a local load balancer

This article is for information only to demonstrate the tasks involved. It is not a recommendation for a production environment!

Support for a production load balancing environment is out of the scope of the iGrafx software installation documentation and highly depends on your network, IT infrastructure and additional factors.

For our example we used Apache as load balancer with mod_jk and sticky sessions, as well as Tomcat servers as nodes for the cluster. To follow our sample scenario you can do the installation on the same physical machine, running Windows 7.  SimpleTcpCluster is included with Tomcat, and provides the clustering capability. Also in this example, we're using DeltaManager for a session replication manager that copies sessions all-to-all across Tomcat nodes.

Get Tomcat servers set up

1.  Install the iGrafx Platform that comes with the predeployed Tomcat.

2.  Next, we'll need to edit the server.xml file for each (found in the \conf dir).

First node

For the first Tomcat, we'll leave all the default ports the same.

  • Connector Port: 8080
  • Shutdown Port: 8005
  • AJP Port: 8009
  • Redirect Port: 8443

If you choose to change these values, make sure that they remain unique when setting up additional Tomcat servers.

In server.xml, uncomment the <Cluster> section, and have it look like this:

CODE
...
	<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
		<Manager className="org.apache.catalina.ha.session.DeltaManager"
		expireSessionsOnShutdown="false"		
		notifyListenersOnReplication="true"/>
	
		<Channel className="org.apache.catalina.tribes.group.GroupChannel">
		
			<Membership className="org.apache.catalina.tribes.membership.McastService"
			address="228.0.0.4"
			port="45564" frequency="500"
			dropTime="3000"/>			
			<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">				
				<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>				
			</Sender>			
			<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" 
			address="auto" port="4000" autoBind="100"
			selectorTimeout="5000" maxThreads="6"/>						
			<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>			
			<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>	
			<Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>						
		</Channel>
		
		<Valve className="org.apache.catalina.ha.tcp.ReplicationValve" />		
		<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener" />		
      </Cluster>
...

Second node

For the second Tomcat, edit its server.xml as well.  First change all the ports by increasing their values by 1, if using the defaults.

  • Connector Port: 8081
  • Shutdown Port: 8006
  • AJP Port: 8010
  • Redirect Port: 8444

If installing your Tomcat instances on different machines, don't worry about using different port values.

Uncomment the <Cluster> section, and use the same lines as with the first Tomcat.  However, make sure to change the jvmRoute value to "worker2".

At this point, you should have 2 different Tomcats running, with the iGrafx Web App available and accessible via ports directly at 8080 and 8081.

Get Apache Httpd Web Server set up

1.  Download Apache http://www.apachehaus.com/cgi-bin/download.plx the documentation is based on 2.4.18x64 and unzip the Apache24 folder to your C:\ drive.

2.  Download the mod_jk binary http://www.carfab.com/apachesoftware/tomcat/tomcat-connectors/jk/binaries/windows/ the documentation is based on x86_64-httpd-2.4.x and unzip it into the \modules directory.

3.  In the \logs directory, add 2 new empty files: mod_jk.shm and mod_jk.log. These files might get automatically created, in this case ignore this step.

4.  In the \conf directory, edit the httpd.conf file.  Find the entry 'Listen 80' and change it to 'Listen 8079'.  Find the entry 'ServerName localhost:80' and change it to 'ServerName localhost:8079' or whichever unique port you prefer.

At the top of this file, add these lines:

CODE
LoadModule jk_module C:\Apache24\modules\tomcat-connectors-1.2.40-windows-x86_64-httpd-2.4.x\mod_jk.so
 
# Path to the worker configuration file
JkWorkersFile C:\Apache24\conf\workers.properties
 
# Where to store information related to logging and memory usage
JkShmFile  C:\Apache24\logs\mod_jk.shm
JkLogFile C:\Apache24\logs\mod_jk.log
JkLogLevel info

# Monitoring of the cluster
JkMount /jkmanager/* jkstatus
<Location /jkmanager>
    Require all granted
</Location>
 
# Map all requests to our web application to the load balancer.
JkMount  /* LoadBalancer

Uncomment the line '#LoadModule access_compat_module modules/mod_access_compat.so', by removing the hash.

5.  In the \conf directory, add a workers.properties file. In it, add these lines:

CODE
# Virtual worker's list
worker.list=jkstatus, LoadBalancer
# Enable virtual workers
worker.jkstatus.type=status
worker.LoadBalancer.type=lb
# Add Tomcat instances as workers, 2 workers in our case
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker2.type=ajp13
worker.worker2.host=localhost
worker.worker2.port=8010
# Provide workers list to the load balancer
worker.LoadBalancer.balance_workers=worker1,worker2
worker.LoadBalancer.sticky_session=true

The port values for both Tomcat worker instances here must match up with what we defined within each Tomcat's server.xml for the ajp13 ports earlier.  Here is where we also tell the load balancer to use Sticky Sessions too. The default for mod_jk is true, but it's safer to explicitly set it.

6.  Use the command prompt, and navigate to the Apache24's \bin directory. Run the command "httpd -k install". You should get a success message.

7.  Using the command prompt from the \bin directory, run the command "httpd -k start". (To shutdown, use "httpd -k stop".)

8.  Open your browser to http://localhost:8079/ (or, whichever port you set for your Apache loadbalancer) to access the iGrafx Web Application (via the Apache load balancer).  http://localhost:8079/jkmanager/ will show the load balancer and worker node(s) status.  If you open up http://localhost:8079/manager , and click on the 'Server Status' link, you can see which node you are currently using by looking at the port number listed here.

Adding more nodes to the cluster

Once you have all of this up and running, it's relatively easy to add more nodes to the cluster.

  1. Make sure the Apache loadbalancer is stopped.
  2. Duplicate one of your Tomcat instance folders.
  3. Follow the steps from above for configuring a Tomcat node, making sure to use unique port values (adding 1 to the previous node's values).
  4. Add 3 new lines to the \conf\workers.properties file, for the new worker node.
  5. Start up the Apache mothership again. Repeat as desired.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.