Friday, November 2, 2012

Assignment of IP Addresses and SCAN


Assignment of IP Addresses
·         Before installing Oracle Clusterware you will want to define the public and private adapter IP addresses. There are two options you can choose with respect to IP address assignment. You can choose static IP addresses for each adapter which will require the assignment of several static IP addresses.
·         Alternatively you can use Oracle Grid Naming Service (GNS) which will require the assignment of one static IP address. GNS will then assign dynamic IP addresses to the nodes of the cluster.
·         When installing Oracle Clusterware you will be prompted to identify the private and public adapters.  Also you should be aware if you perform any maintenance or change the network adapters that the same adapter name (for example ETH1) should be used for the public and private adapters on each server.
·         When assigning the IP address for the private adapter you need to make sure that you use a non-routable IP address, and make sure that all interfaces are configured for the correct speed, duplex and so on.

The VIP, GNS and Single Client Access Name (SCAN)
Several networking components are associated with Oracle Clusterware and Oracle RAC. These include the VIP, the GNS and the SCAN.

The VIP
·         The purpose of the Virtual IP (VIP) is to provide for high availability.
·         A VIP address is assigned to a given node.
·         When that node goes down, the VIP is moved to one of the surviving nodes.
·         This new VIP is re-arped. As a result new connections will get sent to a surviving node, and connections connected to the failed node will receive an error and attempt to re-connect (assuming the application handles the errors gracefully which can be a problem).
·         For clients connected to the failed node, this can speed up the timeout much quicker since they don’t have to wait for a TCP/IP timeout, thus facilitating a quicker failover.
·         When assigning an IP address to the VIP make sure that it is on the same subnet as the default gateway.


Grid Naming Service (GNS)
·         GNS is essentially a DNS for the Oracle Cluster.
·         GNS is an optional networking component of Oracle Clustereware 11g Release 2 that provides for dynamic name resolution in the cluster.
·         GNS removes the need to have static IP addresses assigned to the network nodes.
·         GNS also removes the need to request VIPs if the cluster changes. Instead only one static IP is required which is the GNS virtual IP address.
·         In conjunction with your DHCP server, GNS will then assign dynamic IP addresses/VIPs to the cluster nodes as required. The end result is GNS makes it easier to add and remove cluster nodes.

SCAN
·         Oracle Clusterware 11g Release 2 introduced the Single Client Access Name (SCAN).
·         The SCAN address provides a single address for clients to use when accessing the cluster.
·         Before SCAN, if the cluster changed, then the client TNSNAMES.ORA files (or other tns connect strings like Easy Connect strings) would need to change.
·         The SCAN is a fully qualified domain name that typically resolves to three separate IP addresses. 
·         The SCAN provides a stable address that does not change regardless of the number of nodes on the cluster. 
·         The SCAN also provides for a highly available address, much like the VIPs. The SCAN simplifies network connectivity for applications using Easy Connect strings or JDBC thin client connection strings.
·         If you are using GNS, then you have DHCP support, then the GNS will assign the addresses to the SCAN dynamically. If you are not using GNS then the SCAN will be defined in the DNS server and access requests will be resolved to one of three different IP addresses by the DNS. These addresses resolve to the SCAN listener, and the SCAN listener will resolve the connect request to one of the nodes of the cluster. The SCAN listener will load balance the connection requests to the least busy cluster as they come in.

The following diagram displays the relationships between GNS, SCAN, Listeners and the Oracle Cluster and its associated databases.

 
Administering SCAN Resources

As a Clusterware/RAC administrator you may need to administer SCAN resources on your cluster. This can include:
  • Adding a SCAN VIP resource.
Use the srvctl command to add a SCAN VIP resource as seen in this example where we add a new resource called rac03-scan. Note that this command will create the same number of SCAN VIP resources as there are the number of IP addresses that SCAN resolves to. If you are using DHCP or GPNP then Oracle will configure 3 SCAN VIP’s. Other options in the command allow you to define the network number, subnet and so on:
srvctl add scan –n rac03-scan
  • Removing a SCAN VIP resource.
Use the srvctl command to remove an existing SCAN VIP from the cluster as seen in this example:
srvctl remove scan -f
  • You may want to add a SCAN listener resource. To do so use the srvctl command as seen in the following example. Note in the example that we are assigning the listener to a non-default port:
srvctl add scan_listener –p 65001
  • You may need to remove Clusterware resources from the SCAN listeners. Use the srvctl command to perform this activity as seen here:
srvctl remove scan_listener -f
  • You may need to modify the SCAN VIP to that it matches another SCAN VIP. To do so use srvctl again as seen here:
Srvctl modify scan –n new_scan_name
  • If you have changed the SCAN VIP configuration you will need to update the SCN listeners too. Use the srvctl command to perform this action:
srvctl modify scan_listener -u
  • After making changes to the SCAN listener, you can verify those changes with the srvctl command as seen in this example:
srvctl config scan_listener

 Changing the Public VIP

While Oracle Database 11g Release 2 generally relies on the SCAN addresses (and as a result VIP changes should be less frequent in theory) there may still be times that you need to change the public VIP address. To do so, follow these steps:
·         Stop all services on the node who’s VIP you want to change with the srvctl command. As seen in this example where we :

srvctl stop service –d rdba –s sales, oltp –n rac1
  • Make sure you know the current IP address for the VIP by using the srvctl command as seen here:
srvctl config vip –n rac1
  • Now stop the VIP on the node you will be changing with the srvctl command as seen here:
srvcrl stop vip –n rac1
·         Make the network changes that are required for the new VIP to be identified on the network. This would include changing the /etc/hosts file, the DNS and so on.
  • Using the srvctrl command, change the VIP address to the new address. Note that you will include the IP address of the VIP, the network subnet-mask and the adapter name as seen in this example:
srvctl modify nodeapps –n rac1 –A 192.168.2.100/255.255.255.0/eth0
  • Now, start the VIP on the new node, again using the srvctl command:
srvctl start vip –n rac1
  • Repeat steps 1-6 for each node of the cluster who’s VIP you wish to change.
     
  • Use the cluvfy utility to verify node connectivity as seen in this example:
cluvfy comp nodecon –n all -verbose


1 comment: