问题描述
我从 docs 了解到,复制缓存是使用分区缓存实现的,每个分区密钥具有主副本,并且还备份在集群中的所有其他节点上.当查询数据时,将同时从主&备份到用于服务查询的节点上.
I understand from the docs that replicated caches are implemented using partitioned caches where every key has a primary copy and is also backed up on all other nodes in the cluster & that when data is queried lookups would be made from both primary & backup on the node for serving the query.
但是我看到默认的缓存写同步模式是PRIMARY_SYNC,在该模式下客户端将不等待备份更新.这是否意味着我必须针对复制的缓存将其显式设置为FULL_SYNC,因为响应依赖于对主&的查询.备份?
But i see that the default cache write synchronization mode is PRIMARY_SYNC, where client will not wait for backups to be updated. Does that mean i have to explicitly set it to FULL_SYNC for replicated caches since responses rely on lookup of primary & backup?
推荐答案
第一种选择是使用"FULL_SYNC"模式.在这种情况下,客户端请求将等待所有参与节点(主节点和备份节点)上的写入完成.
The first option is to use 'FULL_SYNC' mode.In that case, client request will wait for write to complete on all participating nodes (primaries and backups).
可在此处使用的第二个选项是使用"PRIMARY_SYNC"并将"CacheConfiguration#readFromBackup"标志设置为false(默认情况下为true).Ignite会将请求发送到主节点并从那里获取值.
The second option, that can be used here, is to use 'PRIMARY_SYNC' and set 'CacheConfiguration#readFromBackup' flag to false (which is true by default).Ignite will send the request to primary node and get the value from there.
请参阅 https://ignite.apache.org/releases/mobile/org/apache/ignite/configuration/CacheConfiguration.html
顺便说一句,这两个选项对于分区缓存也很有意义.
By the way, both options make sense for partitioned cache as well.
这篇关于复制缓存需要显式设置写同步模式FULL_SYNC吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!