Azure-Samples / Azure-Samples/azure-cache-redis-samples
How masterSlaveUsage() works in BasicUsage example
- Dominant language
- Bicep
- Stars
- 77
- Forks
- 169
- Avg merge
- 1h 6m
- Merged PRs (30d)
- 1
Description
Hi @warrenzhu25 .
I noticed Java/ClientSamples/src/main/java/lettuce/BasicUsage.java class contains masterSlaveUsage() method which could be used with Azure Redis Standard and Premium with cluster disabled.
In this method I see following code:
```
StatefulRedisMasterSlaveConnection connection = MasterSlave.connect(client, new Utf8StringCodec(), redisUri);
connection.setReadFrom(ReadFrom.MASTER_PREFERRED);
```
How can this work? Running INFO Replication on Azure premium redis without cluster enabled returns only:
```
xxxxx.redis.cache.windows.net:6379> INFO REPLICATION
# Replication
```
How slaves can be discovered?
Contributor guide
Research direction
Start with Java/ClientSamples/src/main/java/lettuce/BasicUsage.java, focusing on masterSlaveUsage(), MasterSlave.connect, and connection.setReadFrom(ReadFrom.MASTER_PREFERRED). Compare that flow with the Azure Redis INFO REPLICATION output described in the issue. Done means documenting how slave discovery works, or explaining why this example does not apply to the stated Azure configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, java, redis
- Domain
- databases
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100