官术网_书友最值得收藏!

  • Mastering PostgreSQL 9.6
  • Hans Jurgen Schonig
  • 233字
  • 2021-07-09 19:57:10

Using multiple synchronous standby servers

PostgreSQL has been able to perform synchronous replication for quite a while already. In PostgreSQL, it is possible to have more than just one synchronous server from 9.6 onward. Earlier, only one server had to acknowledge a commit. Now it is possible to have an entire group of servers that has to confirm a commit. This is especially important if you want to improve reliability in case of multi-node error.

The syntax to use this new feature is simple:

synchronous_standby_names = '3 (server1, server2, server3, server4) 

However, there is more to synchronous replication in PostgreSQL 9.6. Previously, PostgreSQL ensured (synchronous_commit = on) that the transaction log has reached the slave. However, this did not mean that data was actually visible. Consider an example: somebody adds a user to the master, instantly connects to the slave, and checks for the user. While the transaction log was guaranteed to be on the slave, it was not necessarily guaranteed that the data inside the log was already visible to the end user (due to replication conflicts and so on). By setting synchronous_commit = 'remote_apply', it is now possible to query the slave directly after a commit on the master, without having to worry that data might not be visible yet. The remote_apply value is slower than the on value but it allows to write more advanced applications.

主站蜘蛛池模板: 莱州市| 耒阳市| 云安县| 常德市| 安图县| 宁强县| 繁昌县| 景宁| 洞头县| 新郑市| 凤台县| 历史| 荥阳市| 贵南县| 启东市| 墨江| 邵东县| 界首市| 股票| 汨罗市| 宜良县| 高平市| 福泉市| 岫岩| 双峰县| 南丰县| 逊克县| 枣阳市| 墨竹工卡县| 南木林县| 齐齐哈尔市| 巫溪县| 道真| 黔南| 墨江| 恩施市| 丰原市| 安仁县| 乃东县| 北京市| 永泰县|