Oracle的load_balance和failover

jdbc:oracle:thin:@
 (description=(TRANSPORT_CONNECT_TIMEOUT=1)
  (address_list=(load_balance=off)(failover=on)
   (address=(protocol=tcp)(host=RAC1-vip)(port=1521))
   (address=(protocol=tcp)(host=RAC2-vip)(port=1521))
   (address=(protocol=tcp)(host=RAC3-vip)(port=1521)))
  (connect_data=(service_name=orcl)(failover_mode=(type=select)(method=basic)))
 ) 

LOAD_BALANCE=OFF,客户端进程首先会尝试连接 RAC1-vip,如果连不上,则会尝试RAC2-vip,如果再连不上就尝试RAC3-vip。如果设置为ON则会随机的选择一个做均衡负载。LOAD_BALANCE =on负载均衡,FAILOVER = on 失败自动切换,这两个参数是搭配在一起的。


LOAD_BALANCE
Purpose

To enable or disable client load balancing for multiple protocol addresses.
When you set the parameter to on, yes, or true, Oracle Net progresses the list of addresses in a random sequence, balancing the load on the various listener or Oracle Connection Manager protocol addresses. When you set the parameter to off, no, or false, Oracle Net tries the first address in the address list. If the connection fails and the failover parameter is enabled, then Oracle Net tries the addresses sequentially until one succeeds.
Put this parameter under either the DESCRIPTION_LIST parameter, the DESCRIPTION parameter, or the ADDRESS_LIST parameter.
Default
on for DESCRIPTION_LIST
Values
yes | on | true
no | off | false
Example
net_service_name=
 (DESCRIPTION= 
  (LOAD_BALANCE=on)
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521)))
  (CONNECT_DATA=(SERVICE_NAME=sales.us.example.com))

FAILOVER
Purpose

To enable or disable connect-time failover for multiple protocol addresses.
When you set the parameter to on, yes, or true, Oracle Net, at connect time, fails over to a different address if the first protocol address fails. When you set the parameter to off, no, or false, Oracle Net tries one protocol address.
Put this parameter under the DESCRIPTION_LIST parameter, the DESCRIPTION parameter, or the ADDRESS_LIST parameter.
Default
on for DESCRIPTION_LIST, DESCRIPTION, and ADDRESS_LIST.
Values
yes | on | true
no | off | false
Example
net_service_name=
 (DESCRIPTION= 
  (FAILOVER=on)
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-svr)(PORT=1521))
  (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-svr)(PORT=1521)))
  (CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值