-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to successfully execute JedisCluster.ftCreate(...) method in Redis Cluster environment #3592
Comments
I have the same issue. |
You're using RediSearch Light (assuming from the behavior). This is not the default. Do the following after creating JedisCluster object. JedisCluster.setBroadcastAndRoundRobinConfig(new JedisBroadcastAndRoundRobinConfig() {
@Override public RediSearchMode getRediSearchModeInCluster() { return RediSearchMode.LIGHT; }
}); |
Thanks @sazzad16 for the quick response. redis.clients.jedis.exceptions.JedisClusterOperationException: Cluster retry deadline exceeded.
at redis.clients.jedis.executors.ClusterCommandExecutor.executeCommand(ClusterCommandExecutor.java:124)
at redis.clients.jedis.UnifiedJedis.executeCommand(UnifiedJedis.java:244)
at redis.clients.jedis.UnifiedJedis.checkAndBroadcastCommand(UnifiedJedis.java:260)
at redis.clients.jedis.UnifiedJedis.ftDropIndex(UnifiedJedis.java:3656)
at com.allot.common.data.redis.dao.test.TestRedis.main(TestRedis.java:204) Jedis should calculate a proper slot based on IndexName value and execure FT.CREATE command on proper Master Node, not randomly. I prepared a workaround to solve it locally: Jedis`s implementation of ftCreate method: Jedis should calcuate slot value here, but actually slot value is -1 now: @sazzad16 Please take a look. |
@YaraslauBarysenka Could you please check with latest 5.1.0-snapshot? |
|
|
Looks like it works only since Jedis 5.1.0-snapshot, but is required to set RediSearchMode.LIGHT, otherwise Jedis executes FT.CREATE commands on all Redis Cluster Nodes (all Masters and all Replicas) under the hood and from my point of view it is an issue as well. @sazzad16 , do we have any cases/opportunitinies where we need (or Redis/RedisSearch allow to do it?) to create the same index on all Redis Cluster Nodes? I don't think so. |
@YaraslauBarysenka The default behavior is defined by Redis management. (Apologies for late reply.) |
Resolved by #3593 |
Expected behavior
Index is created using JedisCluster.ftCreate(...) method in Redis Cluster environment.
Actual behavior
JedisExeption occurs in during index creation in Redis Cluster environment using JedisCluster.
Jedis sends FT.CREATE commands to all Cluster Nodes (3 Masters and 3 Replicas) instead of corresponds single Master Node (IndexName`s hash slot value should be related to this Master Node). As result, 5 commands are failed and only 1 command is successed under Jedis hood.
Example of failed FT.CREATE commands: (error) MOVED 15755 127.0.0.1:7002
Steps to reproduce:
Try to create any Index using JedisCluster like this:
`
`
Redis / Jedis Configuration
Redis cluster: 3 Masters and 3 Replicas.
Jedis version:
5.0.1
Redis version:
6.2.7
Java version:
17
The text was updated successfully, but these errors were encountered: