[QUESTION] How Do I navigate between Cluster Nodes ?
ShadowKai opened this issue · 4 comments
Describe the problem
I want to be able to use scan feature for my cluster but it seems to be only getting the keys in whatever master node it's currently in so I tried making a workaround.
So I'm able to get the cluster info from using this:
cluster.redis("any-hash-tag").command("CLUSTER", "SLOTS");
the problem I'm facing is how do i navigate between the nodes ?
when I was using the binary redis-cli I able to switch between nodes using "connect ".
I want to be able to switch to another node based on the IP/PORT or nodeid so that I am able to treat it like a normal redis scan, something like this:
std::unordered_setstd::string output;
cluster.redis("any-hash-tag").scan(0, pattern, count, std::inserter(output, output.begin());
If I understand correctly, after getting all nodes with CLUSTER SLOTS command, you can create a Redis
object for each node, and then do scan with these Redis
objects.
I want to be able to switch to another node based on the IP/PORT or nodeid
Do you mean that you want to switch to another node with an already created Redis
object? This is not supported.
Regards
assuming my cluster configuration is like this
127.0.0.1:8000 (master)
127.0.0.1:8001 (master)
127.0.0.1:8002 (master)
127.0.0.1:8003 (slave)
127.0.0.1:8004 (slave)
127.0.0.1:8005 (slave)
I want the cluster point to port 8000 and perform scan then point it to 8001 and perform scan again etc..., instead of creating a new redis object for each node then do scan with the redis object.
Sorry, but you cannot do that with redis-plus-plus. You have to create a Redis object for each node.
Regards