-
Notifications
You must be signed in to change notification settings - Fork 173
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
redisReply is null #116
Comments
As pointed in #33 .. INFO is command for cluster node. For this to execute we need to execute rediscommand on node. I tried the code locally by adding "redisClusterSetOptionRouteUseSlots(redis)" i do not see any issue. For exact error please print "redis->errstr". If u do not want to use "redisClusterSetOptionRouteUseSlots(redis)", there is a bug in parsing the output of cluster nodes which is causing the issue. To fix, please apply the below patch. diff --git a/hircluster.c b/hircluster.c #define IP_PORT_SEPARATOR ":" +#define PORT_SEPARATOR "@" #define CLUSTER_DEFAULT_MAX_REDIRECT_COUNT 5
@@ -595,6 +609,11 @@ error:
|
@raghuiisc :The same above code works in redis version 4.0. But latest version of redis > 5. For any redisClusterCommand, it will give redis reply null |
redis reply is NULL, but can you please print "redis->errstr" and exact code u are executing. I tried locally and it was working fine. |
there is no issue in connecting redis cluster. Only redisClusterCommand is returning Null always for any command you execute like hmset,hmget etc etc |
If i use the below code, i'm getting redisReply is null
struct timeval timeout = { 1, 500000 }; // 1.5 seconds
redisClusterContext redis = redisClusterContextInit();
redisClusterSetOptionAddNodes(redis, "127.0.0.1:7000");
redisClusterSetOptionConnectTimeout(redis, timeout);
redisClusterConnect2(redis);
if (redis != NULL && redis->err) {
printf("Error: %s\n",redis->errstr);
// handle error
exit(-1);
}
reply = (redisReply) redisClusterCommand(redis, "INFO");
if (reply == NULL){
error(0, "REDIS: INFO reply null to get version failed!");
}
When i add redisClusterSetOptionRouteUseSlots(redis); //The function that has to be called.
Its throwing below exception
Error: Command(cluster slots) reply error: node ip is not string.
Im using the redis version 5. Thanks in advance.
The text was updated successfully, but these errors were encountered: