Postgresql_JDBC_failover_Load-balance_负载均衡_故障切换
来源:互联网 发布:微信 for mac dmg 编辑:程序博客网 时间:2024/06/05 15:51
故障切换:
Connection Fail-over
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 to once connect to each of them in order until the connection succeeds. If none succeed, a normal connection exception is thrown. The syntax for the connection url is:
jdbc:postgresql://host1:port1,host2:port2/database
The simple connection fail-over is useful when running against a high availability postgres installation that has identical data on each node. For example streaming replication postgres or postgres-xc cluster. For example an application can create two connection pools. One data source is for writes, another for reads.
负载均衡:
The write pool limits connections only to master node: jdbc:postgresql://node1,node2,node3/accounting?targetServerType=master .
And read pool balances connections between slaves nodes, but allows connections also to master if no slaves are available: jdbc:postgresql://node1,node2,node3/accounting?targetServerType=preferSlave&loadBalanceHosts=true
targetServerType Allows opening connections to only servers with required state, the allowed values are any, master, slave and preferSlave.
The master/slave distinction is currently done by observing if the server allows writes.
The value preferSlave tries to connect to slaves if any are available, otherwise allows falls back to connecting also to master.
loadBalanceHosts = boolean In default mode (disabled) hosts are connected in the given order. If enabled hosts are chosen randomly from the set of suitable candidates.
refer:https://jdbc.postgresql.org/documentation/94/connect.html#connection-parameters
By:狮子歌歌
- Postgresql_JDBC_failover_Load-balance_负载均衡_故障切换
- 什么是负载均衡/故障转移
- Linux 环境安装IPvsadm+Keepalived 实现故障自动切换及负载均衡
- SQL server故障转移和负载均衡
- SQL server故障转移和负载均衡
- 配置 RAC 负载均衡与故障转移
- memcached单点故障与负载均衡
- 配置 RAC 负载均衡与故障转移
- mysql-故障转移+负载均衡群集
- memcached单点故障与负载均衡
- memcached单点故障与负载均衡
- 负载均衡和故障转移 连载
- memcached单点故障与负载均衡
- 配置 RAC 负载均衡与故障转移
- 负载均衡和自动故障转移
- nginx_负载均衡_集群
- 分布式_负载均衡Nginx
- nginx_反向代理_负载均衡
- <Context path="/ll" docBase="D:\tomcat部署\WebRoot" reloadable="true" debug="0" />各个参数的含义
- Python的分支结构
- 《科学的价值》读后感--时间与空间
- 购物车加减的简单实现
- 如何拿到当前的控制器
- Postgresql_JDBC_failover_Load-balance_负载均衡_故障切换
- Python的for循环
- 使用python在openwrt下操作串口发送十六进制数据
- mybatis generator 逆向工程代码生成
- Python的while循环
- 写在前面的话
- NYOJ 1058 部分和问题
- poj 2104 主席树 详解
- javaWeb实现文件下载