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

"redis.scan is not a function" in cluster mode #2606

Closed
tiye opened this issue Sep 1, 2023 · 3 comments
Closed

"redis.scan is not a function" in cluster mode #2606

tiye opened this issue Sep 1, 2023 · 3 comments

Comments

@tiye
Copy link

tiye commented Sep 1, 2023

Description

I was using SCAN since KEYS is not allowed in production mode. However as I move to cluster mode, running the same code base, I was told:

image

It looks like the code does not expose SCAN on purpose...

image

In my case I want to scan a list of keys I want to delete, what's the suggested way to do this in cluster mode with node-redis?

@sonht1109
Copy link

Still no solutions for this?

@leibale
Copy link
Contributor

leibale commented Sep 12, 2023

@tiye @sonht1109 you can loop over cluster.masters and use scan/scanIterator on each client:

const results = await Promise.all(
    cluster.masters.map(async master => {
        const client = await cluster.nodeClient(master);
        // you can use client.scan or client.scanIterator here
    })
);

this should be added to the docs...

@leibale
Copy link
Contributor

leibale commented Sep 12, 2023

Duplicate of #2446

@leibale leibale marked this as a duplicate of #2446 Sep 12, 2023
@leibale leibale closed this as completed Sep 12, 2023
@leibale leibale closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants