1 / 38

RAC Networking, Failover, and Load Balancing

RAC Networking, Failover, and Load Balancing. Setting up failover, load balancing, TAF and FCF. Objectives. At the end of this module the student will understand the following tasks and concepts. Understand how Oracle Net interacts with RAC.

maris
Download Presentation

RAC Networking, Failover, and Load Balancing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RAC Networking, Failover, and Load Balancing Setting up failover, load balancing, TAF and FCF

  2. Objectives At the end of this module the student will understand the following tasks and concepts. • Understand how Oracle Net interacts with RAC. • Understand how to configure tnsnames for RAC with Transparent Application Failover (TAF) • Understand how to configure JDBC connections for RAC • Understand how to configure Fast Connection Failover as an alternative to RAC

  3. Overview • The Listener • Configuration Files • Oracle Net and RAC • Connect-Time Failover • TAF Failover • Load Balancing • JDBC Configuration for Failover and Load Balancing • Fast Connection Failover

  4. Client Node 2 Listener Node 1 Database

  5. Listener • Resides on the server • Listens for incoming client connection requests • Manages the traffic to the server; when a client requests a network session with a server, the listener actually receives the request and brokers the client request • If the client's information matches the listener's information, then the listener grants a connection to the server.

  6. listener.ora • Configuration file for the listener process. Identifies: • The listener name • Protocol addresses that it will accept connection requests on • Services for which it is listening • Typically resides in the %ORACLE_HOME%\network\admin directory on Windows NT.

  7. tnsnames.ora • Configuration file that determines how you connect to the database. • Connect to specific instance • Load Balancing • Connect Time Failover • TAF Client Failover • Must be present on server and “thick” clients (ODBC and JDBC “thick” OCI driver)

  8. Oracle Net and RAC • Oracle Net understands RAC • Is used to set up the cluster behavior • Supports multiple modes • Connect-Time Failover • Load Balancing • TAF

  9. Connect-Time Failover • One service • Tries one node • then the other node • Used for failover • Balance is done manually • In the event of a failure • Transaction is lost • Session is lost • Reconnection occurs automatically

  10. Connect-Time Failover • TESTA1 = • (DESCRIPTION= •   (ADDRESS_LIST= •     (LOAD_BALANCE=OFF) •     (FAILOVER=ON) •     (ADDRESS=(PROTOCOL=TCP)(HOST=oradb1)(PORT=1521)) •     (ADDRESS=(PROTOCOL=TCP)(HOST=oradb2)(PORT=1521))) •   (CONNECT_DATA= •     (SERVICE_NAME=TESTA) • ) • ) • TESTA2 = •  (DESCRIPTION= •   (ADDRESS_LIST= •     (LOAD_BALANCE=OFF) •     (FAILOVER=ON) •     (ADDRESS=(PROTOCOL=TCP)(HOST=oradb2)(PORT=1521)) •     (ADDRESS=(PROTOCOL=TCP)(HOST=oradb1)(PORT=1521))) •   (CONNECT_DATA= •     (SERVICE_NAME=TESTA) • ) • )

  11. Failover - Backup • Pairs of services • The first service defines the second as its backup • The second service defines the first service as its backup • Used for RAC failover • Balance is done manually • In the event of a failure • Transaction is lost • Session is maintained • Queries are restarted • Reconnection occurs automatically

  12. Failover – Backup • TESTA1 = • (DESCRIPTION = • (ENABLE = BROKEN) • (LOAD_BALANCE = off) • (FAILOVER = on) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb1)(PORT = 1523)) • (CONNECT_DATA = • (SERVICE_NAME = TESTA) • (INSTANCE_NAME = TESTA1) • (FAILOVER_MODE = • (BACKUP = TESTA2) • (TYPE = SELECT) • (METHOD = BASIC) • (RETRIES = 120) • (DELAY = 5)))) • TESTA2 = • (DESCRIPTION = • (ENABLE = BROKEN) • (LOAD_BALANCE = off) • (FAILOVER = on) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb2)(PORT = 1523)) • (CONNECT_DATA = • (SERVICE_NAME = TESTA) • (INSTANCE_NAME = TESTA2) • (FAILOVER_MODE = • (BACKUP = TESTA1) • (TYPE = SELECT) • (METHOD = BASIC) • (RETRIES = 120) • (DELAY = 5))))

  13. Failover - Preconnect • Pairs of services • The first service defines the second as its backup • The second service defines the first service as its backup • Both services preconnect to their backup when the primary connections are made • Used for RAC failover • Balance is done manually • In the event of a failure • Transaction is lost • Session is maintained • Queries are restarted • Connection is quickly switched over to the preconnected backup

  14. Failover - Preconnect • TESTA1 = • (DESCRIPTION = • (ENABLE = BROKEN) • (LOAD_BALANCE = off) • (FAILOVER = on) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb1-vip)(PORT = 1523)) • (CONNECT_DATA = • (SERVICE_NAME = TESTA) • (INSTANCE_NAME = TESTA1) • (FAILOVER_MODE = • (BACKUP = TESTA2) • (TYPE = SELECT) • (METHOD = PRECONNECT) • (RETRIES = 120) • (DELAY = 5)))) • TESTA2 = • (DESCRIPTION = • (ENABLE = BROKEN) • (LOAD_BALANCE = off) • (FAILOVER = on) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb2-vip)(PORT = 1523)) • (CONNECT_DATA = • (SERVICE_NAME = TESTA) • (INSTANCE_NAME = TESTA2) • (FAILOVER_MODE = • (BACKUP = TESTA1) • (TYPE = SELECT) • (METHOD = PRECONNECT) • (RETRIES = 120) • (DELAY = 5))))

  15. Load Balancing • One service • Oracle Net determines which node you use • Tries to balance the load • Only active nodes are used • Balance is somewhat random • In the event of a failure • Transaction is lost • Connection is lost

  16. Load Balancing • TESTA = • (DESCRIPTION = • (ADDRESS_LIST = • (LOAD_BALANCE = on) • (FAILOVER = off) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb1-vip)(PORT = 1523)) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb2-vip)(PORT = 1523)) • ) • (CONNECT_DATA = • (SERVER = DEDICATED) • (SERVICE_NAME = TESTA) • ) • )

  17. Transparent Application Failover • One service • Multiple sessions are created • Only active nodes are used • In the event of a failure • available node is used • No loss of connection • Transaction is lost • Query is restarted

  18. Transparent Application Failover • TESTA = • (DESCRIPTION = • (ENABLE = BROKEN) • (ADDRESS_LIST = • (LOAD_BALANCE = on) • (FAILOVER = on) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb1-vip)(PORT = 1523)) • (ADDRESS = (PROTOCOL = TCP)(HOST = oradb2-vip)(PORT = 1523)) • ) • (CONNECT_DATA = • (SERVER = DEDICATED) • (SERVICE_NAME = TESTA) • (FAILOVER_MODE = • (TYPE = SELECT) • (METHOD = BASIC) • (RETRIES = 120) • (DELAY = 5) • ) • ) • )

  19. Characteristics of TAF • TAF protects: • Client/server connection • User session state • OCI programs • Java thick drivers (OCI drivers) • Sql*plus • Active cursors (select statements) that have begun to return results • Not failed over: • Active update transactions • PL/SQL procedure states • PL/SQL server-side package variables • alter session statements • Server side program variables • Uncommitted transactions

  20. Network Timeouts and TAF • When a “planned” instance shutdown occurs, failover occurs quickly • Shutdown instance with srvctl or OEM • Failover takes a few seconds • When an “unplanned” instance failure occurs, failover timing is sensitive to network timeout parameters • Failover cannot occur until the network connection is released • By default, it may take up to eight minutes for the network connection to be released and for failover to occur • Server-side and client-side operating system level TCP/IP timeout parameters may be shortened to speed up failover • Failover can occur as quickly as one minute • Can increase risk of disrupted network connections and unnecessary failover events

  21. Example Windows TCP/IP Timeout Parameters for TAF • The following steps may be performed on Windows database servers, mid-tier servers, and clients to speed up failover • Open the registry hive under HKEY_LOCAL_MACHINE : SYSTEM CurrentControlSet : Services : Tcpip : Parameters • Add KeepAliveTime : REG_DWORD to the registry Note: The correct case is required for KeepAlive • Set the value to a reasonable timeout. Eg: (120000 = 2 minutes, 60000 = 1 minute)

  22. JDBC Connections and TAF • The Oracle JDBC thick driver supports TAF • tnsnames,ora file must be defined on the server-side • JDBC Data Source file must be defined on the client-side (or mid-tier) • TAF failover and load balancing are supported • The Oracle JDBC thin driver does not fully support TAF • tnsnames,ora file must be defined on the server-side • JDBC Data Source file must be defined on the client-side (or mid-tier) • Load balancing is supported, but not TAF failover

  23. JDBC Thick Driver Example • <data-source • class="com.evermind.sql.DriverManagerDataSource" • name="OracleDS" • location="jdbc/OracleCoreDS" • xa-location="jdbc/xa/OracleXADS" • ejb-location="jdbc/OracleDS" • connection-driver="oracle.jdbc.driver.OracleDriver" • username="scott" • password="tiger" • url="jdbc:oracle:oci8:@(description=(load_balance=on)(failover=on) • (address=(protocol=tcp)(host=db-node1)(port=1521)) • (address=(protocol=tcp)(host=db-node2)(port=1521)) • (address=(protocol=tcp)(host=db-node3)(port=1521)) • (address=(protocol=tcp)(host=db-node4)(port=1521)) • (connect_data= • (service_name=sales.us.oracle.com) • (failover_mode=(type=select)(method=basic)(retries=20)(delay=15))))" • rac-enabled="true" • inactivity-timeout="300" • connection-retry-interval="2" • max-connect-attempts="60" • max-connections="60" • min-connections="12" • />

  24. JDBC Thin Driver Example • <data-source • class="com.evermind.sql.DriverManagerDataSource" • name="OracleDS" • location="jdbc/OracleCoreDS" • xa-location="jdbc/xa/OracleXADS" • ejb-location="jdbc/OracleDS" • connection-driver="oracle.jdbc.driver.OracleDriver" • username="scott" • password="tiger" • url="jdbc:oracle:thin:@(DESCRIPTION= • (LOAD_BALANCE=on) • (ADDRESS=(PROTOCOL=TCP) (HOST=host1) (PORT=1521)) • (ADDRESS=(PROTOCOL=TCP) (HOST=host2) (PORT=1521)) • (CONNECT_DATA=(SERVICE_NAME=service_name)))" • inactivity-timeout="300" • connection-retry-interval="2" • max-connect-attempts="60" • max-connections="60" • min-connections="12" • />

  25. Fast Application Notification • ONS and Fast Application Notification • The Oracle Notification Service provides a framework for passing event messages about failover between nodes • ONS may notify both RAC nodes and client or mid-tier nodes • Fast Application Notification provides the basis for Fast Connection Failover

  26. Fast Connection Failover • Fast Connection Failover provides a way to control failover response • Effective for Oracle 10g Application Server JDBC connections • More mid-tier applications may be supported in the future • Works with JDBC Thick and JDBC Thin drivers • Provides an alternative to TAF • Avoids network timeout sensitivity • Fast and efficient

  27. Pre-requisites for Fast Connection Failover • The JDBC Implicit Connection Cache is enabled. • The application uses service names to connect to the database, not service ids. • The database should be at least release 10.1.0.2 (10.1.0.3 is preferred). • ONS is configured and running on the node where JDBC is running. • The JVM in which the JDBC instance is running must have oracle.ons.oraclehome set to point to the ORACLE_HOME where the ONS files were installed.

  28. Setting Up the Implicit Connection Cache for FCF • The following JDBC Data Source file sets up the Implicit Connection Cache for FCF on the Application Tier: • OracleDataSource ods = new OracleDataSource() • ... • ods.setUser(“Scott”); • ods.setPassword(“tiger”); • ods.setConnectionCachingEnabled(True); • ods.setFastConnectionFailoverEnabled(True); • ods.setConnectionCacheName(“MyCache”); • ods.setConnectionCacheProperties(cp); • ods.setURL("jdbc:oracle:thin:@(DESCRIPTION= • (LOAD_BALANCE=on) • (ADDRESS=(PROTOCOL=TCP)(HOST=VIP1)(PORT=1521)) • (ADDRESS=(PROTOCOL=TCP)(HOST=VIP2)(PORT=1521)) • (CONNECT_DATA=(SERVICE_NAME=service_name)))");

  29. ONS on the Applications Tier • The Oracle Notification Service must be installed and running on the Applications Tier nodes • The ONS client is available with the 10.1.0.3 client CD • For the 10.1.0.2 ONS client, contact Oracle Support • Run “onsctl ping” on each application node to determine that ONS is running

  30. ONS on the Applications Tier • Edit the file %ORACLE_HOME%\opmn\conf\ons.config on each mid-tier node: • localport=6100 # This is the port ONS is writing to on this node • remoteport=6200 # This is the port ONS is listening on this node • loglevel=3 • # This is the list of hosts and ports ONS is posting to. • # Include RAC and client nodes. • nodes=RAC1.mycompany.com:6200,RAC2.mycompany.com:6200, • RAC3.mycompany.com:6200,APPS1.mycompany.com:6200, • APPS2.mycompany.com:6200

  31. ONS on the Applications Tier • When starting the application: • Specify the system property –Doracle.ons.iraclehome=<location of ons on client> • Include the ons.jar file in the application CLASSPATH

  32. Modifying Server-Side ONS for FCF • Use the %ORA_CRS_HOME%\bin\racgons command to modify the server-side ONS configuration to be aware of the mid-tier nodes: • racgons add_config APPS1.mycompany.com:6200 APPS2.mycompany.com:6200 • This adds the host and port names to the OCR

  33. Differences between FCF and TAF • Application-Level Connection Retries. • Fast Connection Failover supports application-level connection retries. This gives the application control of responding to connection failovers. • TAF supports connection retries only at the OCI/Net layer.

  34. Differences between FCF and TAF • Integration with the Connection Cache • Fast Connection Failover is well-integrated with the Implicit Connection Cache, which allows the connection cache manager to manage the cache for HA. • Failed connections are automatically invalidated in the cache. • TAF works at the network level on a per-connection basis, which means that the connection cache cannot be notified of failures.

  35. Differences between FCF and TAF • Event-Based • Fast Connection Failover is based on the RAC event mechanism. This means that Fast Connection Failover is efficient and detects failures quickly for both active and inactive connections. • TAF is based on the network call mechanism.

  36. Differences between FCF and TAF • Load-Balancing Support • Fast Connection Failover supports UP event load balancing of connections and runtime work request distribution across active RAC instances.

  37. Review • What are the two key configuration files for Oracle Net? • What key phrase in the tnsnames.ora file influences load balance behaviour? • What key phrase in the tnsnames.ora file influences failover behaviour? • Which Oracle Net configurations allow users to maintain connections through a failover event? • Which JDBC drivers are supported under TAF and FCF? • What is the name of the utility to add mid-tier nodes to the server-side ONS configuration?

  38. Summary • Listener process • Configuration files • listener.ora • tnsnames.ora • Failover • Basic • Preconnect • Load Balancing • TAF • JDBC Thick and Thin drivers and TAF • Setting up Fast Connection Failover

More Related