Configuring JDBC Multi Data Sources - 11g Release 1 (10.3.6)
Choosing the Multi Data Source Algorithm
Before you set up a multi data source, you need to determine the primary purpose of the multi data source—failover or load balancing. You can choose the algorithm that corresponds with your requirements.
Failover
The Failover algorithm provides an ordered list of data sources to use to satisfy connection requests. Normally, every connection request to this kind of multi data source is served by the first data source in the list. If a database connection test fails and the connection cannot be replaced, or if the data source is suspended, a connection is sought sequentially from the next data source on the list.
Note:
This algorithm requires that Test Reserved Connections (TestConnectionsOnReserve
) on the data source is enabled. If enabled, a connection in the first data source is tested to verify if the data source is healthy. If the connection fails the test, the multi data source uses a connection from the next data source listed in the multi data source. See Connection Testing Options for a Data Source for information about configuring TestConnectionsOnReserve
.
JDBC is a highly stateful client-DBMS protocol, in which the DBMS connection and transactional state are tied directly to the socket between the DBMS process and the client (driver). For this reason, failover of a connection while it is in use is not supported.
Load Balancing
Connection requests to a load-balancing multi data source are served from any data source in the list. The multi data source selects data sources to use to satisfy connection requests using a round-robin scheme. When the multi data source provides a connection, it selects a connection from the data source listed just after the last data source that was used to provide a connection. Multi data sources that use the Load Balancing algorithm also fail over to the next data source in the list if a database connection test fails and the connection cannot be replaced, or if the data source is suspended.
Multi Data Source Fail-Over Limitations and Requirements
WebLogic Server provides the Failover algorithm for multi data sources so that if a data source fails (for example, if the database management system crashes), your system can continue to operate. However, you must consider the following limitations and requirements when configuring your system.
Test Connections on Reserve to Enable Fail-Over
Data sources rely on the Test Reserved Connections (TestConnectionsOnReserve
) feature on the data source to know when database connectivity is lost. Testing reserved connections must be enabled for the data sources within the multi data source. WebLogic Server will test each connection before giving it to an application. With the Failover algorithm, the multi data source uses the results from connection test to determine when to fail over to the next data source in the multi data source. After a test failure, the data source attempts to recreate the connection. If that attempt fails, the multi data source fails over to the next data source.
No Fail-Over for In-Use Connections
It is possible for a connection to fail after being reserved, in which case your application must handle the failure. WebLogic Server cannot provide fail-over for connections that fail while being used by an application. Any failure while using a connection requires that the application code close the failed connection, and the transaction must be restarted from the beginning with a new connection.
Multi Data Source Failover Enhancements
The following enhancements improve failover processing for multi data sources:
-
Connection request routing enhancements to avoid requesting a connection from an automatically disabled (dead) data source within a multi data source. SeeConnection Request Routing Enhancements When a Data Source Fails.
-
Automatic failback on recovery of a failed data source within a multi data source. See Automatic Re-enablement on Recovery of a Failed Data Source within a Multi Data Source.
-
Failover for busy data sources within a multi data sources. See Enabling Failover for Busy Data Sources in a Multi Data Source.
-
Failover callbacks for multi data sources with the Failover algorithm. See Controlling Multi Data Source Failover with a Callback.
-
Failback callbacks for multi data sources with either algorithm. See Controlling Multi Data Source Failback with a Callback.
Linode VPS服务器介绍及购买指引
Linode优化建议
- 充分利用Linode服务器四核运算能力:榨干服务器,让进程运行在指定的CPU
- 简单快捷地备份Linode数据:备份数据库到S3
- 系统初装之后,建议进行一次LAMP最小优化
- 其他有关Linode的文章
Linode技术支持
Linode很适合作为Linux入门的材料。但对不熟悉shell的朋友,可能一开始安装软件、配置服务器都比较困难。
我提供有偿的技术支持,能解决大部分Linode上的配置问题,以及迁移网站的问题。详细请看:提供Linode技术支持。
FAQ
Q:什么样的人适合用linode?
A:由于Linode是Linux的VPS,所以需要有一定的Linux操作功底。当然,对不熟悉Linux服务器的人,也无疑是一次锻炼的机会。我就是在不熟悉Linux的情况下开始用Linode的。
Q:Linode主机价格如何?
A:Linode的VPS是相当价廉的VPS,价格要比Slicehost便宜约30%,比起MediaTemple就更加有优势。Linode的VPS有多种配置,最便宜一款$19.95。年付打9折。所有VPS配置列表可以在Linode首页找到。
Q:使用Linode会不会被墙?
A:每个Linode都有独立IP,这至少可保障你的网站不会被别人牵连。如果自己的IP被墙了,购买一个extra IP需要每个月1美金。BTW,可以在Linode上搭建VPN,极大方便平日流连Youtube、Facebook等资本主义国家的网站。
Q:Linode如何备份?
A:Linode提供了备份服务,但我更建议备份到Amazon S3。我编写了一个备份脚本,可以在Linode上用于备份数据。推荐使用。
Q:购买Linode应如何付款?
A:需要一张支持美金支付的信用卡,Linode不支持Paypal。经过测试,招行信用卡可以成功支付。
Q:Linode服务器速度如何?
A:请看 Linode4个机房的速度比较(杭州电信)。测试方法为单线程在4个机房的服务器上分别下载91M的文件。
机房 | 速度 |
Fremont, CA | 140.90 KB/s |
Dallas, TX | 8.33 KB/s |
Atlanta, GA | 55.65 KB/s |
Newark, NJ | 141.09 KB/s |
测试下载的文件和简要说明在此。
可以看到,Fremont机房和Newark机房都是很好的选择。我的Linode选择了Fremont机房,可以在此处实际测试一下服务器的速度(测出的数值除以8就是相应的KB/sec)。
注:最近也有朋友发现达拉斯机房的速度很不错,相比Fremont/Newark要好。所以建议大家购买时,自己实际测试下,选一个表现最好的。
Q:使用Linode如何进行备份?
A:Linode自己提供了backup的服务,按照不同等级的Plan进行收费。如果数据确实很重要,备份到Amazon S3也是个很好的选择。当然,我是把一些重要数据备份到Dreamhost服务器的。一个关键的优势在于:服务器放在国外,不管是连接S3还是连Dreamhost都是飞快,而且没有GFW。
Linode VPS 简介和使用指南
Linode VPS 购买教程
1、登录 Linode 官网 ,http://www.linode.com/
2、选择适合你自己的套餐,点击购买。
我选择linode 1024这个套餐,进行下面的购买及支付需要一张支持美元的信用卡,VISA、MASTER Card都可以。国内大部分银行的都可以,我这里使用的招商银行的信用卡。
Linode 服务器介绍及购买指引
如果您觉得本文对您有用处,你可以在购买的时候在Referral Code栏填写: "a396a5bacb1e332ff04e632704ea309036cf4c88"
如果有朋友看了我的文章觉得有用的话,恰好你又要购买 Linode 的 VPS,不妨使用我的 Refer 代码,于己无损,于人受益。
点击“continue”之后,回来到一个信息确认页面,有个协议需要确认,单击小方框,出现小勾就行了。
还有一个需要注意的是,好像不容易买到刚好一个月,比如我26号买的,这个月剩余的5天,我同样需要购买,实际上我支付了1个月15天,共计:23.82美元。事后,后台截图:
5、上步确认之后,你的Linode vps就购买完成了,手机上也收到了银行发来的信用卡支付信息,同时邮箱也受到订单的信息和帐号激活信息。