node-redis

Node JS Redis Client Connection Retry

跟風遠走 提交于 2021-02-07 20:51:26
问题 Currently I'm using https://github.com/mranney/node_redis as my node redis client. client.retry_delay is set to 250ms default. I tried connecting to redis and once connection was successful, I manually stopped the redis server to see whether client.retry_delay works. But I didn't see it working. The following log messages are logged on ready & end events on redisClients created using createClient : [2012-03-30 15:13:05.498] [INFO] Development - Node Application is running on port 8090 [2012

Node JS Redis Client Connection Retry

断了今生、忘了曾经 提交于 2021-02-07 20:49:23
问题 Currently I'm using https://github.com/mranney/node_redis as my node redis client. client.retry_delay is set to 250ms default. I tried connecting to redis and once connection was successful, I manually stopped the redis server to see whether client.retry_delay works. But I didn't see it working. The following log messages are logged on ready & end events on redisClients created using createClient : [2012-03-30 15:13:05.498] [INFO] Development - Node Application is running on port 8090 [2012

How to namespace keys on redis to avoid name collisions?

こ雲淡風輕ζ 提交于 2021-01-21 08:46:22
问题 I want to use redis to store some of my own key-value pairs, however some of my modules already use it. The redis express session store for session data, as well as the redis adapter for socket io. So my question is simple, how can I create or designate a database/namespace to store my own keys without key collisions? I am using the node-redis driver. 回答1: Solution 1: Store data of different modules in different Redis instances The most strictly isolation is storing data of each module in an

node_redis CONFIG SET command

独自空忆成欢 提交于 2020-01-24 14:29:00
问题 I am currently writing an app using redis and I'm having issues with the node_redis library. In particular I am unable to figure out how to use the redis command from within node_redis I have tried all the following... client.send_command("CONFIG SET", ["notify-keyspace-events", "Ex"]); client.config("SET", ["notify-keyspace-events", "Ex"]); This and other similar variants don't seem to be working... Also I cannot find the command detailed out on the node_redis documentation. Any help would

How to setup a Redis Database with RDB backup every 5mins in Node.Js

你。 提交于 2020-01-17 00:43:26
问题 So i just found REDIS an in-memory Database, the problem is that if my server crashes or something goes wrong with the REDIS server all my data will be lost. Thats when i tried to find a way to backup the data, RDB was my choice so i tried to find a tutorial for it. I didnt find any, so how could you setup RDB backups for REDIS in Node.Js? I know how to setup the REDIS server and a client for it, and add and get data from the server. Thats not the problem. Oh, and how can you restore the

Node redis publisher consuming too much memory

有些话、适合烂在心里 提交于 2020-01-15 05:11:28
问题 I wrote a small redis publisher in node by using node_redis library. After the program is done publishing 1M messages, it continues to hold up around 350 MB of memory. Can anyone provide any clues why the program requires so much memory and how the memory can be released? Following is the code snippet - var redis = require("redis"), publisher = redis.createClient(); var i = 0; for (;;) { publisher.publish("rChat", i); i++; if (i == 1000000) { console.log("stopped sending messages");

How to pipeline in node.js to redis?

被刻印的时光 ゝ 提交于 2019-12-31 21:22:51
问题 I have lot's of data to insert (SET \ INCR) to redis DB, so I'm looking for pipeline \ mass insertion through node.js . I couldn't find any good example/ API for doing so in node.js, so any help would be great! 回答1: Yes, I must agree that there is lack of examples for that but I managed to create the stream on which I sent several insert commands in batch. You should install module for redis stream: npm install redis-stream And this is how you use the stream: var redis = require('redis-stream

How to pipeline in node.js to redis?

你离开我真会死。 提交于 2019-12-31 21:22:46
问题 I have lot's of data to insert (SET \ INCR) to redis DB, so I'm looking for pipeline \ mass insertion through node.js . I couldn't find any good example/ API for doing so in node.js, so any help would be great! 回答1: Yes, I must agree that there is lack of examples for that but I managed to create the stream on which I sent several insert commands in batch. You should install module for redis stream: npm install redis-stream And this is how you use the stream: var redis = require('redis-stream

How to fix a race condition in node js + redis + mongodb web application

ぃ、小莉子 提交于 2019-12-31 05:23:06
问题 I am building a web application that will process many transactions a second. I am using an Express Server with Node Js. On the database side, I am using Redis to store attributes of a user which will fluctuate continuously based on stock prices. I am using MongoDB to store semi-permanent attributes like Order configuration, User configuration, etc., I am hitting a race condition when multiple orders placed by a user are being processed at the same time, but only one would have been eligible