balancing PostgreSQL queries using two different Spring datasources

We're attempting to set up a PostgreSQL cluster using streaming replication inside Kubernetes, but we'd prefer to avoid the trouble of going through the configuration of pgpool or any other SQL-aware load-balancers.

That being said, I'd like to ask whether it is a good idea at all to configure Spring Boot to use two datasources in the following way:

  • The first ( @Primary ) datasource would point towards the current PostgreSQL master and be used for read and write operations.
  • The second datasource would point towards a hot-standby replica and be used for read operations.
  • Provided that there are Kubernetes services that point to the current master and to the read replicas, and that failover is not automated, are there any risks in this approach?

    链接地址: http://www.djcxy.com/p/77390.html

    上一篇: 在启用Windows身份验证的情况下,IIS响应IIS中的CORS请求

    下一篇: 使用两个不同的Spring数据源来平衡PostgreSQL查询