Skip to content

Commit

Permalink
Redis Client: improve documentation for sentinel and cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicek committed Feb 8, 2024
1 parent 4151049 commit 486e198
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion docs/src/main/asciidoc/redis-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,16 @@ quarkus.redis.hosts=redis://localhost:5000,redis://localhost:5001,redis://localh
quarkus.redis.client-type=sentinel
# Optional
quarkus.redis.master-name=my-sentinel # Default is my-master
quarkus.redis.master-name=my-sentinel # Default is mymaster
quarkus.redis.role=master # master is the default
----

The host URLs here must be the sentinel servers.
The client will obtain the URLs of actual Redis servers (master or replicas, depending on `role`) from one of the sentinels, using the `master-name` as an identifier of the "master set".

Note that you practically never want to configure `quarkus.redis.role=sentinel`.
This setting means that the Redis client will execute commands directly on one of the sentinel servers, instead of an actual Redis server guarded by the sentinels.

=== Use the Cluster Mode

When using Redis in cluster mode, you need to pass multiple _host urls_, configure the client type to `cluster` and configure the `replicas` mode:
Expand All @@ -188,6 +194,10 @@ quarkus.redis.client-type=cluster
quarkus.redis.replicas=share
----

The host URLs here must be some of the cluster members.
Not all cluster members need to be configured, as the client will obtain a full cluster topology from one of the known servers.
However, it is advisable to configure at least 2 or 3 nodes, not just 1.

=== Use the replication Mode

When using the replication mode, you need to pass a single host url and configure the type to be `replication`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public interface RedisClientConfig {
/**
* The master name (only considered in HA mode).
*/
@ConfigDocDefault("my-master")
@ConfigDocDefault("mymaster")
Optional<String> masterName();

/**
Expand Down

0 comments on commit 486e198

Please sign in to comment.