Search code examples
apachehttpd.confmod-jk

Redirecting specific request to a node in cluster using modjk


I have created a cluster(load balancer) which consists of two node node1 and node2, now i want node2 to handle specific request like /context/heavyservice1, /context/vheavyservice and both node1 and node2 to handle /context/service (which is working fine) , my question is how can i configure modjk so that node 2 will handle some servcies.

Below is some part of my configuartion

worker.list= lbNode
worker.lbNode.type=lb


worker.node1.type=ajp13

worker.node1.port=8009

worker.node1.host=server1

worker.node2.type=ajp13

worker.node2.port=8009

worker.node2.host=server2

worker.lbNode.balance_workers=node1,node2

Solution

  • You could test this way:

    worker.list=lbNode,node1,node2
    
    worker.node1.type=ajp13
    worker.node1.port=8009
    worker.node1.host=server1
    
    worker.node2.type=ajp13
    worker.node2.port=8009
    worker.node2.host=server2
    
    worker.lbNode.balance_workers=node1,node2
    worker.lbNode.type=lb
    

    Then you must set the mappings. You can set mappings to different nodes in the same virtual host (or in the default host, without creating any virtual host). Just use JKMount and JKUnMount to match your requirements

    JKMount /context lbNode
    JKMount /context/* lbNode
    JKUnMount /context/heavyservice1 lbNode
    JKUnMount /context/vheavyservice lbNode
    JKMount /context/heavyservice1 node2
    JKMount /context/vheavyservice node2