Config readMode from SLAVE but redirect to MASTER
See original GitHub issueExpected behavior
- The Lua script executes on the Slave node
Actual behavior
- The Lua script executes on the Master node
Steps to reproduce or test case
Here is the Java code:
redissonClient
.getScript()
.evalSha(
RScript.Mode.READ_ONLY,
"<sha1-hash>",
RScript.ReturnType.MULTI,
getKeys(),
getArgs());
Here is the Lua script
local id = redis.call("CLUSTER", "MYID")
redis.log(redis.LOG_NOTICE, "I'm get master account " .. id)
return redis.call('hmget', KEYS[1], unpack(ARGV))
After executing Java code and the Redis’s log like bellow
We can see that the Lua script is executed on the master node (127.0.0.1:7001) instead of the slave node (127.0.0.1:7005), but I have already config the readMode to SLAVE & pass the RScript.Mode.READ_ONLY config when evalSha.
Please help me correct if I’m wrong, thanks!
Redis version
v6.2.0
Redisson version
v3.16.2
Redisson configuration
redissonConfig:
clusterServersConfig:
idleConnectionTimeout: 10000
pingTimeout: 1000
connectTimeout: 3000
timeout: 5000
retryAttempts: 2
retryInterval: 100
failedSlaveReconnectionInterval: 3000
failedSlaveCheckInterval: 60000
password: null
subscriptionsPerConnection: 5
clientName: null
subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 10
slaveConnectionMinimumIdleSize: 1
slaveConnectionPoolSize: 1
masterConnectionMinimumIdleSize: 1
masterConnectionPoolSize: 4
readMode: "SLAVE"
subscriptionMode: "MASTER"
scanInterval: 1000
pingConnectionInterval: 1000
keepAlive: true
tcpNoDelay: true
nodeAddresses:
- "redis://127.0.0.1:7000"
- "redis://127.0.0.1:7001"
- "redis://127.0.0.1:7002"
- "redis://127.0.0.1:7003"
- "redis://127.0.0.1:7004"
- "redis://127.0.0.1:7005"
threads: 128
nettyThreads: 128
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Should I read from a Redis Cluster slave? - Stack Overflow
It's possible and a usual pattern to read from slaves but it ... Normally slave nodes will redirect clients to the authoritative master...
Read more >Learn why Redis client read requests are read from or ...
I'm using ElastiCache for Redis. Why are my Redis client read requests always read from or redirected to the primary node of a...
Read more >mrniko/redisson - Gitter
Hi, I'm using Redisson 3.6.2 and I'm having some problems with DNS resolving. When my app initially connects to my Redis cluster using...
Read more >ORM Master/Slave Replication - Synopse Open Source
This synchronization will work as a strict master/slave replication scheme, as a one-way on demand refresh of a replicated table.
Read more >Device manual - ifm
6.2.3 Configuration of the DeviceNet units in the RS network for DeviceNet. ... Flashing: AS-i voltage ( Power) present but no slave communication ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Done
In my case, I’m using Redisson 3.16.7 with Redis 6.0.5 (on ElastiCache) with Cluster mode OFF and this works as expected: the code is executed on replicas:
Now I’m trying to update to Redisson 16.7.5 and as soon as I do it, all the LUA executions are run on master only, which blocks me to update because the master gets overloaded.
@mrniko is there anything in particular that got updated around this topic between Redisson 3.16.7 and 16.7.5?
Seems the READ_ONLY mode is working fine on Redisson 3.16.7 when Redis 6.0.5 is used with cluster mode OFF and having only read replicas.