条件:
- jdk 1.6及以上
配置:
jdbc:postgresql://host1:port1,host2:port2/database
连接故障转移:
To support simple connection fail-over it is possible to define multiple endpoints (host and port pairs) in the connection url separated by commas. The driver will try once to connect to each of them in order until the connection succeeds. If none succeeds a normal connection exception is thrown.
为了支持简单的故障转移, 可以配置多个端点(host:port),多个端点之间以逗号隔开。驱动程序将尝试按顺序连接到它们中的每一个,直到连接成功。如果没有成功,则引发正常连接异常。
The simple connection fail-over is useful when running against a high availability postgres installation that has identica
JDBCPostgreSQL的故障转移连接配置与高可用应用示例

本文介绍了如何在JDBCPostgreSQL中实现连接故障转移,通过配置多个端点支持高可用性环境,如流式复制或postgres-xc集群。还展示了如何利用连接池区分写入和读取操作,以及在服务器故障时的连接策略。
最低0.47元/天 解锁文章
825






