AWS JDBC Driver连接中国区的Aurora需要配置参数 enableClusterAwareFailover=false

AWS JDBC Driver 中国区和Global区域的区别是,由于中国区Aurora Endpoint与Global的后缀不同,中国区的AWS JDBC Driver其实无法识别中国区endpoint, 因为中国区的资源endpoint是以".cn" 结尾,这个endpoint不被认为是aurora的endpoint,会被认为是custom domain.

因此应用程序在使用AWS JDBC Driver连接中国区的Aurora,需要配置参数:enableClusterAwareFailover=false

没有配置参数的话会发生如下报错:

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: The clusterInstanceHostPattern configuration property is required when an IP address or custom domain is used to connect to a cluster that provides topology information. If you would instead like to connect without failover functionality, set the enableClusterAwareFailover configuration property to false.

但是我们不必担心开启了这个参数以后,在Aurora发生故障转移的时候自动故障转移,因为驱动描述是有自己的failover机制,可以在dns解析替换之前发现新的实例的ip,更快速连接进去。

AWS JDBC Driver的github:

AWS MySQL JDBC Driver does not recognize Aurora endpoint in China · Issue #233 · awslabs/aws-mysql-jdbc · GitHub

其实用MySQL JDBC Driver也没啥问题的~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值