Giriş
Şu satırı dahil ederiz
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
readFrom metodu
Açıklaması şöyle. Okuma işleminin nerede yapılacağını belirtir.
ÖrnekAll ReadFrom settings except MASTER may return stale data because replicas replication is asynchronous and requires some delay. You need to ensure that your application can tolerate stale data.Setting DescriptionMASTER Default mode. Read from the current master node.MASTER_PREFERRED Read from the master, but if it is unavailable, read from replica nodes.REPLICA Read from replica nodes.REPLICA_PREFERRED Read from the replica nodes, but if none is unavailable, read from the master.LOWEST_LATENCY Read from any node of the cluster with the lowest latency.ANY Read from any node of the cluster.ANY_REPLICA Read from any replica of the cluster.
Şöyle yaparız
LettuceClientConfiguration clientConfig = LettuceClientConfiguration.builder() .commandTimeout(redisCommandTimeout) .readFrom(ReadFrom.REPLICA_PREFERRED) .build();
Hiç yorum yok:
Yorum Gönder