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

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.

主站蜘蛛池模板: 固原市| 嘉义县| 安仁县| 江川县| 板桥市| 登封市| 永新县| 安塞县| 阿图什市| 丹凤县| 广元市| 宿松县| 聂拉木县| 莆田市| 安新县| 缙云县| 曲沃县| 佛坪县| 康平县| 汕头市| 荃湾区| 绥滨县| 乐至县| 北京市| 双辽市| 驻马店市| 谢通门县| 崇信县| 偏关县| 垫江县| 图片| 托里县| 淮安市| 获嘉县| 中西区| 滨海县| 利津县| 尚志市| 平舆县| 东宁县| 东乡|