RAC1 RAC2 都需需要配置监听,各自监听自己的 实例;
客户端使用SERVER的虚拟IP配置2个监听地址;
为什么使用虚拟地址?
监听地址使用 VIP(如果没有vip,连接失败节点的process会有一个比较长的tcp超时等待,才能返回错误,有了vip后,节点失效后,由于vip漂移到其它节点,连接该vip的process很快就能返回错误,从而更快的尝试连接其它活动的节点)
客户最终连接到哪个INSTANCE?
如果客户端没有指定连接到哪个实例则 决定分配到哪个实例由以下2个设置决定:
Client-Side Load Balancing(CLB):
由客户端tnsname.ora配置
Server-Side Load Balancing(SLB)
==================
情况1:客户设置CLB后 ,随机请求一个INSTANCE,该实例所在服务器端(默认都会设置SLB)的监听根据该实例PMON进程返回的所有INSTANCE目前情况(session数或elipse tiime)决定导向用户到哪个INSTANCE的监听。
情况2:客户没有设置CLB,则只请求的第一个ADDR 节点,软如果监听没有响应 会导致TIMEOUT错误。
=================
如果使用DBCA创建RAC默认已经设置 SLB,有2中SLB可设置:
Short—Connections are distributed across instances based on the elapsed time
under the service. Use the Short connection load balancing goal for applications
that have connections of small duration.
■ Long(默认 适合连接池或者报表)—Connections are distributed across instances based on the number of
sessions per instance, for each instance that supports the service. Use the Long
connection load balancing goal for applications that have connections of long
duration. This is typical for connection pools and SQL*Forms sessions. Long is the
default connection load balancing goal.
---
可以在客户端TNS文件配置 实现连接到特定某个INSTANCE(sunny2)
SUNNY67 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 142.100.14.69)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 142.100.14.70)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sunny)
(instance_NAME = sunny2)
)
)
In an Oracle RAC database, client connections should use both types of connection
load balancing. When you create an Oracle RAC database using Oracle Database
Configuration Assistant (DBCA), DBCA configures and enables server-side load
balancing by default.
ORA