Forum Discussion
Brian_11882
Mar 18, 2011Nimbostratus
Yes, that's the basic flow. LB:status has states "session_enabled" and "session_disabled", but I don't see how these are used in the default LB algorithms. They may simplify what I need. I'll use my starting/stopping states to show the behavior I'm looking for even though they don't seem to exists. I'm assuming that a node can respond with a state for LB:status to indicate its ability to accept connections.
when HTTP_REQUEST {
if([HTTP:cookie exists oraclePartition]) {
Map node id to IP and port found in a class
Entries should be strings of the form
set node_data [findclass [HTTP:cookie oraclePartition] $::my_nodes " "]
set node_ip [getfield $node_data " " 1]
set node_port [getfield $node_data " " 2]
if([LB:status pool my_pool member $node_id $node_port up]) {
pool my_pool member $node_ip $node_port
} else if([HTTP:cookie exists JSESSIONID] and [LB:status pool my_pool member $node_id $node_port stopping]) {
// continue on the designated node
pool my_pool member $node_ip $node_port
} else if([HTTP:cookie not exists JSESSIONID] and [LB:status pool my_pool member $node_id $node_port starting]) {
// Allow on the starting node
pool my_pool member $node_ip $node_port
}
}
}
I'd like the starting state to mean "only accept new sessions" and the stopping state to mean "continue with existing sessions, but do not accept connection from new sessions" as in the example above. In the example, I assume that when a connection is assigned to a member, by default it will stick for the remainder of the session unless the node is not up.