Skip to content
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

Does hiredis-cluster support SCAN #216

Open
throwbear opened this issue May 11, 2024 · 1 comment
Open

Does hiredis-cluster support SCAN #216

throwbear opened this issue May 11, 2024 · 1 comment

Comments

@throwbear
Copy link

I call redisClusterCommand func to execute SCAN operation but got err:No keys in command(must have keys for redis cluster mode)

the code is as follows:

  cluster_ctx = redisClusterContextInit();
  redisClusterSetOptionAddNodes(cluster_ctx, rdbhosts);
  redisClusterConnect2(cluster_ctx);
  if (cluster_ctx == NULL || cluster_ctx->err)
  {
    printf("Error connect cluster: %s\n", cluster_ctx->errstr);
  }
  int cursor = 0;
  char *pattern = "key*";
  redisReply *reply = redisClusterCommand(cluster_ctx, "SCAN %d MATCH %s", cursor, pattern);
  if (reply == NULL)
  {
    printf("scan cluster reply null: %s\n", cluster_ctx->errstr);
  }
  redisClusterFree(cluster_ctx);
@bjosv
Copy link
Collaborator

bjosv commented May 13, 2024

The suggestion is to use the low-level API, see this issue #50 (comment) with similar topic.

Unfortunately there are no examples of SCAN, but maybe you can get some ideas from https://github.com/Nordix/hiredis-cluster/blob/master/tests/ct_specific_nodes.c#L46 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants