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

Cluster support? #55

Open
mullerivan opened this issue Jan 2, 2019 · 4 comments
Open

Cluster support? #55

mullerivan opened this issue Jan 2, 2019 · 4 comments

Comments

@mullerivan
Copy link

Hi there what about connecting to 10 cluster servers, there is any way to do it?

@RangerMauve
Copy link
Collaborator

@mullerivan I think you should be able to create the connections to the client manually, and then pass them into the options like so:

var NRP = require('node-redis-pubsub');

var redisPub = redis.createClient();
var redisSub = redis.createClient();

var config = {
  emitter: redisPub,                      // Pass in an existing redis connection that should be used for pub
  receiver: redisSub,                     // Pass in an existing redis connection that should be used for sub
}

var nrp = new NRP(config); // This is the NRP client

That's assuming you can use the cluster stuff with a regular redis client.

@mullerivan
Copy link
Author

Coll that looks really good,
but actually i was thinking in something like having N redis running in a server in different ports and
load the balance into this N redis, something like this

 var config = {
        scope: 'some-scope'
            [host: '64.65.66.67' port: 9000,],
            [host: '64.65.66.67' port: 9001,],
            [host: '64.65.66.67' port: 9002,]};
 var nrp = new NRP(config)

something similar to this: but just for Pubsub
https://github.com/luin/ioredis#cluster

@RangerMauve
Copy link
Collaborator

I'm not 100% sure if ioredis is compatible with this library, but if it is you should be able to pass it in as the emitter and receiver connections.

I don't think it makes sense to add special conditions for cluster support in the NRP config, though.

@mullerivan
Copy link
Author

@RangerMauve Thanks for your time dude

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