Configuring NetScaler for Oracle RAC Primary Standby Deployment

Configuring NetScaler for Oracle RAC Primary Standby Deployment

book

Article ID: CTX200304

calendar_today

Updated On:

Description

Oracle monitor can be used to detect the health of an Oracle server and based on this information, server can be marked UP or DOWN. While making load balancing decision, NetScaler will decide whether to forward traffic to this server or not. In Oracle Real Application Cluster (RAC) environment with primary and standby server, primary server will serve both read-write requests while standby server will only serve read requests. There can be cases where the lag between primary and secondary server will be beyond a threshold where data fetched from standby server will be unacceptably stale. In such circumstances read requests must go to the primary server. NetScaler monitor can be helpful in such circumstances. NetScaler can probe (at application level) servers to find out the lag between primary and standby server and if the lag is beyond a threshold. If the lag is below threshold then server will remain UP and when the lag is beyond threshold then server will be DOWN. Based on this, standby server will be selected for servicing the requests only if the lag is below the threshold.

The following is a NetScaler configuration which allows requests to go to primary server when secondary server lag is beyond threshold:
add services to NetScaler
add service svc_primary TCP <ip>  <port>
add lb vserver lb_primary TCP 10.102.147.67 1521
bind lb vserver lb_primary svc_primary

add service svc_secondary TCP <ip>  <port>
add lb vserver lb_secondary TCP 10.102.147.69 1521 -backupvserver lb_primary
bind lb vserver lb_secondary svc_secondary

In the preceding example "lb_primary" is added as backup for "lb_secondary", which causes traffic to be forwarded to "lb_primary" when "lb_secondary" is DOWN.

Now create a monitor which detects a lag of less than or equal to 5 seconds and mark the service UP or DOWN accordingly. Bind this monitor to "service_secondary" server.

add lb monitor mon_ora ORACLE-ECV -userName hr -sqlQuery "Select extract(second from to_dsinterval(value)) + extract(minute from to_dsinterval(value))*60 + extract (hour from to_dsinterval(value))*60*60 from v$dataguard_stats where name in (\'apply lag\')" -evalRule "oracle.res.row(0).num_elem(0).le(5)"
bind service svc_secondary -monitorName mon_ora


> add db user hr -password hrpassword
Done
> add lb monitor mon_ora ORACLE-ECV -userName hr -sqlQuery "Select extract(second from to_dsinterval(value)) + extract(minute from to_dsinterval(value))*60 + extract (hour from to_dsinterval(value))*60*60 from v$dataguard_stats where name in (\'apply lag\')" -evalRule "oracle.res.row(0).num_elem(0).le(5)"
Done

Whenever the traffic comes to "lb_secondary" and it is DOWN because of lag beyond a limit, traffic is forwarded to primary server and whenever the lag comes down within the limit, service will become UP and "lb_secondary" will continue forwarding requests to it.

User-added image

Issue/Introduction

Configuring NetScaler for Oracle RAC primary standby deployment.