How does connection re-direction occur in RAC? (Part 1)

I have always been curious as to how a connection request is redirected in a RAC. In other words, let’s assume we have a two node cluster with a given service that only runs on one of the nodes.

In this case the reqman service runs only on linux1. In our URL, we only have the linux2 node listed. This ensures the connection request will need to be “handled” in some way to ensure it makes to the “right” server.

linux1-vip = 192.168.1.150
linux2-vip = 192.168.1.154
client     = 192.168.1.70

On the client, we then use tcpdump to capture all packets on the interface used to connect.

tcpdump -iwlan0 -n tcp port 1521 -A -s1500

In another window, we use our TNS alias to connect to the service using the configuration noted at the beginning of this article.

Below, we snip much of what was output, and leave only the relevant lines.

We first see our request going to linux2…

20:00:47.603134 IP 192.168.1.70.40133 > 192.168.1.154.oracle: P 1:216(215) ack 1 win 46 
E...1.@[email protected].....
.4Y....d.........:.,.A ............:....AA........................
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux2-vip)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ReqMan)(CID=(PROGRAM=python@HOWARDS)(HOST=HOWARDS)(USER=root))))

…and shortly thereafter, a return packet is sent back to the client. Notice it contains a reference to linux1-vip…

20:00:47.606520 IP 192.168.1.154.oracle > 192.168.1.70.40133: P 11:268(257) ack 216 win 1716 
E..5..@[email protected]............
...e.4Y..........
@(ADDRESS=(PROTOCOL=TCP)(HOST=linux1-vip)(PORT=1521)).(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux2-vip)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ReqMan)(CID=(PROGRAM=python@HOWARDS)(HOST=HOWARDS)(USER=root))(SERVER=dedicated)(INSTANCE_NAME=tst10g1)))

…and a few milliseconds after that, we see our client connecting to linux1…

20:00:47.615509 IP 192.168.1.70.39634 > 192.168.1.150.oracle: P 1:257(256) ack 1 win 46 
E..4..@[email protected]..#..T<....E......
.4Y;()...........:.,.A ............:....AA........................
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linux2-vip)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ReqMan)(CID=(PROGRAM=python@HOWARDS)(HOST=HOWARDS)(USER=root))(SERVER=dedicated)(INSTANCE_NAME=tst10g1)))

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.