RAC connection management整理
RAC connection management整理
对于RAC来说,当Oracle Instance失败的,应用有几种高可用技术来保证可用性,这些技术对客户端来说都是透明的,客户端可能感知不到instance failure。
一.Transparent Application Failover (TAF)
二.Fast Connection Failover (FCF).
当一个节点failure的时候,TAF允许数据库session使用OCI libraries进行fail over到其他存活的一个节点。但是如果应用使用JDBC thin driver则不能使用TAF。
Failover Modes:
Session failover
Select failover
None(default)
1.select mode允许query重新在新的节点执行,并且丢弃已经fetch的行,继续返回结果给客户端。
2.none mode显式的声明不使用TAF
3.TAF不能够恢复任何DML事务,事务将在另一个节点回滚。
Failover Methods:
Basic
Preconnect
1.Basic选项意味着客户端在实例失败后重新建立新的连接,这个method可能导致节点失败时,另一节点的性能下降,因为有很多的session将要重新连接到幸存的节点。
2.客户端产生一个preconnected session作为备份,在实例失败时加速failover。
TAF是client-side feature,我们需要配置它在客户端Tnsnames.ora或者server端通过service来实现
1,客户端实现
RAC中在tnsnames.ora里面典型配置如下:
- LEO1 =
- (DESCRIPTION_LIST =
- (LOAD_BALANCE = off)
- (FAILOVER = on)
- (DESCRIPTION =
- (ADDRESS_LIST =
- (LOAD_BALANCE=OFF)
- (FAILOVER=ON)
- (ADDRESS = (PROTOCOL = TCP)(HOST = node1.chinamobile.com)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = leo)
- (INSTANCE_NAME = leo1)
- (FAILOVER_MODE=(TYPE=session)(METHOD=basic)(RETRIES=4)(DELAY=1))
- )
- )
- (DESCRIPTION =
- (ADDRESS_LIST =
- (LOAD_BALANCE=OFF)
- (FAILOVER=ON)
- (ADDRESS = (PROTOCOL = TCP)(HOST = node2.chinamobile.com)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = leo)
- (INSTANCE_NAME = leo2)
- (FAILOVER_MODE=(TYPE=session)(METHOD=basic)(RETRIES=4)(DELAY=1))
- )
- )
- )
2,server端实现
- srvctl add service -d leo -s cmcc -q TRUE -P BASIC -e SESSION -z 4 -w 5 具体使用参数如下:
- Usage: srvctl add service -d <db_unique_name> -s <service_name> {-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}]
- | -g <pool_name> [-c {UNIFORM | SINGLETON}] } [-k <net_num>] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]]
- [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}]
- [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <failover_retries>] [-w <failover_delay>] [-t <edition>] [-f]
- -d <db_unique_name> Unique name for the database
- -s <service> Service name
- -r "<preferred_list>" Comma separated list of preferred instances
- -a "<available_list>" Comma separated list of available instances
- -g <pool_name> Server pool name
- -c {UNIFORM | SINGLETON} Service runs on every active server in the server pool hosting this service (UNIFORM) or just one server (SINGLETON)
- -k <net_num> network number (default number is 1)
- -P {NONE | BASIC | PRECONNECT} TAF policy specification
- -l <role> Role of the service (primary, physical_standby, logical_standby, snapshot_standby)
- -y <policy> Management policy for the service (AUTOMATIC or MANUAL)
- -e <Failover type> Failover type (NONE, SESSION, or SELECT)
- -m <Failover method> Failover method (NONE or BASIC)
- -w <integer> Failover delay
- -z <integer> Failover retries
- -t <edition> Edition (or "" for empty edition value)
- -j <clb_goal> Connection Load Balancing Goal (SHORT or LONG). Default is LONG.
- -B <Runtime Load Balancing Goal> Runtime Load Balancing Goal (SERVICE_TIME, THROUGHPUT, or NONE)
- -x <Distributed Transaction Processing> Distributed Transaction Processing (TRUE or FALSE)
- -q <AQ HA notifications> AQ HA notifications (TRUE or FALSE)
- Usage: srvctl add service -d <db_unique_name> -s <service_name> -u {-r "<new_pref_inst>" | -a "<new_avail_inst>"} [-f]
- -d <db_unique_name> Unique name for the database
- -s <service> Service name
- -u Add a new instance to service configuration
- -r <new_pref_inst> Name of new preferred instance
- -a <new_avail_inst> Name of new available instance
- -f Force the add operation even though a listener is not configured for a network
- -h Print usage
- Fast Connection Failover and Fast Application Notification
FAN是一种消息发布机制,在instance up/down发布消息到客户端,来进行群集的重新配置,FCF是通过FAN来透明的进行
instance failure failover。
FCF支持的客户端驱动:
Java Database Connection Driver (JDBC)
Oracle Universal Connection Pool UCP
Clients using the Oracle Call Interface
Oracle Data Providers for .Net
在11R2(11.2.0.1)中当设置了db_domain参数,FCF将会失效,bug:8779597
更多Oracle相关信息见Oracle 专题页面 http://www.bkjia.com/topicnews.aspx?tid=12
评论暂时关闭