Here the post is not meant for briefing anything about what a VIP is and how it works etc., Here our briefing focuses on how RAC utilized VIP.
Consider that we have a 2 node RAC environment with the below mentioned details –
NODE Static IP address Virtual IP address ======================================================================= racnode1 192.168.1.100 192.168.1.200 (racnode1) (racnode1_vip1) racnode2 192.168.1.101 192.168.1.201 (racnode2) (racnode2_vip2)
Let’s assume that the Listeners are configured with Static IP’s of the nodes. So the tnsnames on client side will be configured as shown below –
tnsnames.ora on a client ------------------------------------------ Service1 = (DESCRIPTION = (ADDRESS=(PROTOCOL=TCP)(HOST=racnode1)(PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=racnode2)(PORT=1521)) (CONNECT_DATA = (SERVICE_NAME = Service1) ) )
With this configuration, client initially tries connecting to the node that is first available in the address list (i.e racnode1). If all is well connection with the node(racnode1) will be established and client can perform the tasks.
Let us see what happens in the scenario of a node(racnode1) not available.
Even in this case, client tries to establish a connection with the racnode1 as it is first in its address list. But since the node(racnode1) is not available, client tries to establish it’s connection with the next available address in the list (i.e racnode2). So, there is a delay to move from one node to other. This is called Connect-Time Failover.
So, a Failover is happening here which is a good thing – right!! Ofcourse it is. But the Problem here is that the TIME (TCP TIMEOUT) it takes to failover, which will be ranging between a few seconds to a few minutes. For a very high critical systems/environments this is not acceptable.
Oracle overcome this problem of TCP TIMEOUT’s by using VIP Address.
Let us see how this problem is resolved using the Virtual IP Address. As shown above assign each node with a VIP address. Configure the Listeners with VIP’s instead of static IP’s. Now the tnsnames on the client side will be configured as below –
tnsnames.ora on a client (VIP is used) ------------------------------------------ Service1 = (DESCRIPTION = (ADDRESS=(PROTOCOL=TCP)(HOST=racnode1_vip1)(PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=racnode2_vip2)(PORT=1521)) (CONNECT_DATA = (SERVICE_NAME = Service1) ) )
When all nodes are functioning properly, each VIP will be listening for any client connections and direct those connections to corresponding Listener and Service.
Suppose if a node fails, CRS will kicks in and move the failed node’s VIP to one of the surviving nodes of the cluster. Any connection attempts to the failed node by using VIP will be handled by the failed node’s VIP that is currently residing on one of the surviving node. This (failed node’s VIP) will respond immediately to client by sending an error indicating that there is no listener. Upon receiving the infomation of no listener, client immediately retry connection using the next IP in the address list. Thus reduces the time to failover.
In this way RAC utilizes Virtual IP for faster failover.