내 응용 프로그램에 대해 다음과 같은 서버가 있습니다 (가상으로). 나는 MySQL과 함께 일한다.MySQL을 사용하는 스프링 풀 연결
응용 프로그램 (일본에있는 서버)
2) 데이터베이스 백업 (페루에있는 서버)
3) 비상 데이터베이스 (미국에 위치한 서버)
나는 몇 가지있다가 사용 1) 데이터베이스 Spring의 기능에 대한 질문 :
가) 모든 데이터 소스에서 동시에 유지할 수있는 방법은 무엇입니까?
B) Spring에서 연결 풀을 만들어서 첫 번째 데이터 소스가 응답하지 않으면 시스템이 두 번째 데이터 소스와 자동으로 작동하도록 어떻게 할 수 있습니까?
이것은 내 실제 applicationContext-datasource.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>META-INF/database.properties</value>
</property>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}"/>
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="dataSource"/>
</property>
</bean>
감사
당신은 몇 가지 심각한 대기 시간이 더를 받고되지거야? 한 가지 옵션은 두 데이터 소스를 모두 정의하고 첫 번째가 응답하는지 프로그래밍 방식으로 확인하고 그렇지 않으면 두 번째를 사용합니다. – thatidiotguy
그건 문제가 아니야. 학문적 인 프로젝트 야. 그래서 서버가 가까이에있다. 최대 절전 모드의 Stuff와 나의 @Autowired Datasources는 애플리케이션이 다른 데이터베이스와 함께 작동 중임을 알 필요가 없습니다. 그게 연결 수영장 rigth의 본질? – dimondi21