Code Monkey home page Code Monkey logo

node_redis_cluster's People

Contributors

h0x91b avatar joaojeronimo avatar mathieumg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node_redis_cluster's Issues

Some question

Did you know how PUB/SUB working in cluster?

Did it replicate message to each node or I need to do it over one specific node like regular redis?

Extreme Slow Down When using Client

Has anyone experienced a lot of slow down in basic Redis operations when using this implementation? I'm talking about 10 seconds or more when just using the example in the README.

Error when hashing the slot for unicode strings

When hashing for example this string:

nht.reach.accounts:زووم

the slot computed is 15073, while according to redis the slot is 4107

This causes an Error: MOVED 4107 ... that cannot be fixed.

Function r.multi() returns undefined object

Object everything works fine my code, gets to this line of code:

  var multi = r.multi();

Object multi gets undefined. Do you have an idea maybe?

I should also mention, that if i use r.get and r.set the system works fine, but i should use transactions.

Global redisLinks

Referring to the redisLinks property that is exposed through module.exports
https://github.com/joaojeronimo/node_redis_cluster/blob/master/index.js#L317

In a project where there are multiple redis clusters being used, the redisLinks property will point to the nodes of the most recently created client. Given that a client can be created either by a user or by receiving a 'MOVED' command, there is almost no way of reliably determining what redisLinks is pointing to. Unless there is a really good reason for keeping redisLinks around, I am in favor of removing it from the API altogether.

Other node not connected

In the function connectToLink the link that has to be parsed is in the form :@
When the client (fastRedis or normal client) is created the string @ is used as port and the connection fail.
The solution is changing the first line of code in the function with this two rows:

var ss = str.split('@');
var spl = ss[0].split(':');

hmset error

I'm trying to use hmset:

           redisConnection.hmset(personId, {
                tagId: req.params.tagId,
                personHash: req.params.personHash
            }, function(err, reply) {
                if (err) {
                    throw err;
                }

                assert(reply, 'OK');
            });

And got error:
/app/node_modules/redis-cluster/node_modules/redis/index.js:563
throw callback_err;
^
TypeError: Object Error: ERR wrong number of arguments for 'hmset' command has no method 'substr'
at Command.callback (/srv/http/pagetag-js-test/node_modules/redis-cluster/index.js:181:18)
at RedisClient.return_error (/srv/http/pagetag-js-test/node_modules/redis-cluster/node_modules/redis/index.js:559:25)
at ReplyParser. (/srv/http/pagetag-js-test/node_modules/redis-cluster/node_modules/redis/index.js:308:18)
at ReplyParser.emit (events.js:95:17)
at ReplyParser.send_error (/srv/http/pagetag-js-test/node_modules/redis-cluster/node_modules/redis/lib/parser/javascript.js:296:10)
at ReplyParser.execute (/srv/http/pagetag-js-test/node_modules/redis-cluster/node_modules/redis/lib/parser/javascript.js:181:22)
at RedisClient.on_data (/srv/http/pagetag-js-test/node_modules/redis-cluster/node_modules/redis/index.js:535:27)
at Socket. (/srv/http/pagetag-js-test/node_modules/redis-cluster/node_modules/redis/index.js:91:14)
at Socket.emit (events.js:95:17)
at Socket. (_stream_readable.js:765:14)

So what is correct way to use hmset function?

client.quit does not actually quit the connection to redis server

Hi.
We have had a problem where, when we try and quit the connection by client.quit()
the tcp connection to redis server is not actually quit/killed/ended.
it still remains and we got a lot of connections on redis server.

I just took a look at the code and could nto find a line of code which actually ended the stream connection.

Any updates on this would be really appriciated.

TypeError: Cannot call method 'split' of undefined

Hi, João,
I am trying to connect to a redis cluster (version 2.9.11) and I have the following error:

iMac-de-Carlos:loudspotter-node carlosballock$ sudo node server.js

/Users/carlosballock/node_modules/redis/index.js:582
throw err;
^
TypeError: Cannot call method 'split' of undefined
at /Users/carlosballock/node_modules/redis-cluster/index.js:42:30
at try_callback (/Users/carlosballock/node_modules/redis/index.js:579:9)
at RedisClient.return_reply (/Users/carlosballock/node_modules/redis/index.js:664:13)
at HiredisReplyParser. (/Users/carlosballock/node_modules/redis/index.js:312:14)
at HiredisReplyParser.EventEmitter.emit (events.js:95:17)
at HiredisReplyParser.execute (/Users/carlosballock/node_modules/redis/lib/parser/hiredis.js:43:18)
at RedisClient.on_data (/Users/carlosballock/node_modules/redis/index.js:535:27)
at Socket. (/Users/carlosballock/node_modules/redis/index.js:91:14)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket. (_stream_readable.js:746:14)

The following is the result of calling "cluster nodes" in my cluster in 2 moments:

  1. Moment 1:
    8e9910e26febc9a2122c03f62beee4d589436b24 :0 myself,master - 0 0 0 connected

  2. Moment 2:

dd6e13b627a9b54337ec4718119ebddb99902cb0 127.0.0.1:6381 master - 0 1381638532662 0 connected 10922-16383
8e9910e26febc9a2122c03f62beee4d589436b24 :0 myself,master - 0 0 0 connected 0-5460
349630e9c51ae4b41aefdbab2511644b3512dc1d 127.0.0.1:6380 master - 0 1381638532662 0 connected 5461-10921

Shouldn't the "connectToNodesOfCluster" function be like this? (refer to the FIXME comments below)

function connectToNodesOfCluster (firstLink, callback) {
var redisLinks = [];
var fireStarter = connectToLink(firstLink);
fireStarter.cluster('nodes', function(err, nodes) {
if (err) {
callback(err, null);
return;
}
var lines = nodes.split('\n');
var n = lines.length -1;
while (n--) {
var items = lines[n].split(' ');
var name = items[0];
var flags = items[2];
var link = ( flags === 'myself' || flags === 'myself,master') ? firstLink : items[1];
var linkState = items[7]; // FIXME: this index was incremented;
if (lines.length === 1 && lines[1] === '') {
var slots = [0, 16383]
} else {
var slots = items[8].split('-'); // FIXME: this index was also incremented;
}
console.log(linkState);
if (linkState === 'connected') {
redisLinks.push({name: name, link: connectToLink(link), slots: slots});
}
if (n === 0) {
console.log(redisLinks);
callback(err, redisLinks);
}
}
});
}

In both of these moments, the same error occurred. Please, can you help me with that?
Regards,

Carlos.

old node-redis inside node_redis_cluster

Hi Joao, first, congratulations with the cluster lib, everything for my app is working after refactor, but i notice the version of the redis inside node_redis_cluster is too old 0.8.x and today we are @ 2.2.3 with a lot of enhancements & commands.

Are u thinking in repacking the node_redis_cluster with the latest node_redis?

If not could u show me the way?

tanx!

LUA eval not recognizing key slot

I am using the poor man cluster client to run a basic lua script:
"return redis.call('GET', 'foo')"
but the client is not able to recognize where the key "foo" is stored.

Is there a way to do this besides parsing CLUSTER SLOTS to find the keyslot for foo manually?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.