加载中…
个人资料
sqlora
sqlora
  • 博客等级:
  • 博客积分:0
  • 博客访问:6,500
  • 关注人气:8
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Oracle的load_balance和failover

(2018-11-29 13:11:48)
分类: oracle
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)))
--------------------- 
作者:深圳gg 
来源:CSDN 
版权声明:本文为博主原创文章,转载请附上博文链接!

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有