Load Balancer Setup for 3-Node Oracle RAC Database
1.
Objective
This document explains the Load
Balancer setup and network architecture for a 3-node Oracle RAC environment. It
covers:
- RAC network flow
- SCAN configuration
- VIP configuration
- Load balancer options
- Recommended architecture
- DNS and listener setup
- Best practices
2. Oracle RAC Network Architecture
A 3-node Oracle RAC typically
contains:
|
Component |
Purpose |
|
Public IP |
Node communication with clients |
|
Private IP |
Interconnect for Cache Fusion |
|
VIP (Virtual IP) |
Fast failover for node failures |
|
SCAN IP |
Client connection abstraction |
|
Listener |
Accepts database connections |
3. Example Network Layout
|
Node |
Hostname |
Public
IP |
VIP
IP |
Private
IP |
|
Node1 |
rac1 |
192.168.1.101 |
192.168.1.111 |
10.10.10.1 |
|
Node2 |
rac2 |
192.168.1.102 |
192.168.1.112 |
10.10.10.2 |
|
Node3 |
rac3 |
192.168.1.103 |
192.168.1.113 |
10.10.10.3 |
4. SCAN (Single Client Access Name)
Oracle recommends SCAN for all RAC
environments.
SCAN
Requirements
- Minimum 3 SCAN IPs
- One SCAN Name
- Round Robin DNS entry
Example:
|
SCAN
Name |
SCAN
IPs |
|
rac-scan.company.com |
192.168.1.120 |
|
192.168.1.121 |
|
|
192.168.1.122 |
5. DNS Configuration
Example DNS entries:
rac1.company.com 192.168.1.101
rac2.company.com 192.168.1.102
rac3.company.com 192.168.1.103
rac1-vip.company.com 192.168.1.111
rac2-vip.company.com 192.168.1.112
rac3-vip.company.com 192.168.1.113
rac-scan.company.com 192.168.1.120
rac-scan.company.com 192.168.1.121
rac-scan.company.com 192.168.1.122
Verify:
nslookup rac-scan.company.com
Expected:
- All 3 SCAN IPs returned
6. How Load Balancing Works in RAC
Oracle RAC provides built-in load
balancing using:
A.
SCAN Listener
Distributes connections across:
- Node listeners
- RAC instances
B.
Local Listener
Each node listener handles local
instance traffic.
C.
Server-side Load Balancing
Oracle automatically redirects
clients to least loaded instances.
7. Connection Flow
Application
|
v
SCAN Listener
|
+-------------------+
| | |
v v v
Node1
Node2 Node3
Listener
Listener Listener
| | |
Instance1 Instance2 Instance3
8. Do We Need External Load Balancer?
Usually
NOT Required
Oracle RAC SCAN already provides:
- Load balancing
- Connection failover
- High availability
9. When External Load Balancer is Needed
Use external LB only when:
|
Scenario |
Need
LB? |
|
Web applications |
Yes |
|
DR routing |
Yes |
|
Multi-site traffic |
Yes |
|
SSL offloading |
Yes |
|
Non-Oracle clients |
Sometimes |
|
Standard RAC DB access |
No |
10. Recommended Load Balancers
Hardware
- F5 BIG-IP
- Citrix ADC
- A10 Networks
Software
- HAProxy
- NGINX
- LVS
11. F5 Load Balancer Example
Virtual
Server
VIP: 192.168.1.200
Port: 1521
Pool
Members
192.168.1.111:1521
192.168.1.112:1521
192.168.1.113:1521
Health
Check
TCP Port 1521
12. HAProxy Example
Install
yum install haproxy -y
Configuration
frontend oracle_front
bind *:1521
mode tcp
default_backend oracle_backend
backend oracle_backend
mode tcp
balance roundrobin
server rac1 192.168.1.111:1521 check
server rac2 192.168.1.112:1521 check
server rac3 192.168.1.113:1521 check
Restart:
systemctl restart haproxy
13. Oracle Client Connection String
Recommended
EZConnect
sqlplus
system/password@//rac-scan.company.com:1521/PROD
TNS
Example
PRODDB=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=rac-scan.company.com)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=PROD)
)
)
14. Verify SCAN Listener
Check
SCAN listeners
srvctl status scan_listener
Check
SCAN configuration
srvctl config scan
Listener
status
lsnrctl status
15. Best Practices
Network
Best Practices
Public
Network
- Use bonded NICs
- Minimum 1 Gbps
- Prefer 10 Gbps
Private
Interconnect
- Dedicated NICs
- Jumbo frames recommended
- Low latency network
SCAN
- Always configure 3 SCAN IPs
- Use DNS instead of /etc/hosts
VIP
- Separate from public IPs
- Same subnet as public IP
16. High Availability Flow
Node
Failure Scenario
Example:
- Node2 crashes
Flow:
- VIP relocates
- Connections fail fast
- SCAN redirects new sessions
- Surviving nodes continue service
This minimizes application downtime.
17. Important Oracle RAC Ports
|
Port |
Purpose |
|
1521 |
Listener |
|
6200 |
ONS |
|
1630 |
GNS |
|
53 |
DNS |
|
22 |
SSH |
18. Typical Production Architecture
+----------------+
| Applications |
+--------+-------+
|
v
+----------------+
| SCAN Listener |
+--------+-------+
|
+---------------+---------------+
| | |
v v v
+-----------+ +-----------+ +-----------+
| RAC1 |
| RAC2 |
| RAC3 |
| Listener | | Listener
| | Listener |
+-----------+ +-----------+ +-----------+
| | |
+---------------+---------------+
|
ASM + Shared Storage
19. Troubleshooting Commands
Check
Cluster
crsctl stat res -t
Check
VIP
srvctl status vip -n rac1
Check
Listener
lsnrctl status LISTENER
Verify
Interconnect
oifcfg getif
20. Recommendation
For most Oracle RAC deployments:
✅ Use:
- SCAN listeners
- VIPs
- Oracle native load balancing
❌ Avoid:
- External LB unless business requires it
Oracle RAC itself is already a highly optimized database load balancing solution.