Configuring a local load balancer
This example demonstrates the tasks involved — it is not a recommendation for a production environment. Supporting a production load-balancing setup is outside iGrafx's scope and depends on your network and IT infrastructure.
This worked example uses Apache as a load balancer with mod_jk and sticky sessions, in front of two Tomcat cluster nodes on one Windows machine. SimpleTcpCluster (included with Tomcat) provides clustering, and DeltaManager replicates sessions across all nodes.
Prerequisites
- The iGrafx platform installed with the pre-deployed Tomcat (one installation per node).
Steps
Configure the Tomcat nodes
Edit each node's server.xml (in its \conf directory).
First node — keep the default ports (Connector 8080, Shutdown 8005, AJP 8009, Redirect 8443). If you change them, keep them unique across nodes. Uncomment the <Cluster> section so it reads:
<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 — if using the defaults, increase each port by 1 (Connector 8081, Shutdown 8006, AJP 8010, Redirect 8444). On different machines you don't need different ports. Uncomment the same <Cluster> section, but change jvmRoute to worker2.
You should now have two Tomcats running, reachable directly at ports 8080 and 8081.
Set up the Apache HTTP server
-
Download Apache (this example uses 2.4.18 x64) and unzip the
Apache24folder toC:\. -
Download the
mod_jkbinary (this example usesx86_64-httpd-2.4.x) and unzip it into\modules. -
In
\logs, add two empty files:mod_jk.shmandmod_jk.log(skip if they're created automatically). -
In
\conf\httpd.conf, changeListen 80toListen 8079andServerName localhost:80toServerName localhost:8079(or your preferred unique port). Add these lines at the top: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 fileJkWorkersFile C:\Apache24\conf\workers.properties# Where to store logging and memory-usage informationJkShmFile C:\Apache24\logs\mod_jk.shmJkLogFile C:\Apache24\logs\mod_jk.logJkLogLevel info# Monitoring of the clusterJkMount /jkmanager/* jkstatus<Location /jkmanager>Require all granted</Location># Map all requests to the web application to the load balancerJkMount /* LoadBalancerThen uncomment
#LoadModule access_compat_module modules/mod_access_compat.so. -
In
\conf, add aworkers.propertiesfile:# Virtual worker listworker.list=jkstatus, LoadBalancer# Enable virtual workersworker.jkstatus.type=statusworker.LoadBalancer.type=lb# Add Tomcat instances as workers (2 in this example)worker.worker1.type=ajp13worker.worker1.host=localhostworker.worker1.port=8009worker.worker2.type=ajp13worker.worker2.host=localhostworker.worker2.port=8010# Provide the worker list to the load balancerworker.LoadBalancer.balance_workers=worker1,worker2worker.LoadBalancer.sticky_session=trueThe worker ports must match the AJP ports in each Tomcat's
server.xml. This also sets sticky sessions —mod_jkdefaults totrue, but it's safer to set it explicitly. -
From Apache24's
\bindirectory, runhttpd -k install. -
Run
httpd -k start(usehttpd -k stopto shut down). -
Open
http://localhost:8079/(or your load-balancer port) to reach the application through the load balancer.http://localhost:8079/jkmanager/shows the load balancer and worker status;http://localhost:8079/manager→ Server Status shows which node you're on by its port.
Add more nodes
- Stop the Apache load balancer.
- Duplicate one of your Tomcat instance folders.
- Configure the new Tomcat node with unique ports (add 1 to the previous node's values).
- Add three lines to
\conf\workers.propertiesfor the new worker node. - Start Apache again. Repeat as needed.