Questions tagged [node-redis]

node-redis is a complete Redis client for node.js. It supports all Redis commands, including many recently added commands like EVAL from experimental Redis server branches.

756 questions
9
votes
2 answers

How to get index of latest element in List Redis?

How to get index of latest element in List Redis? For example in List is stored id's of messages, I need get last ID message and return index this element.
PiligrimBilim
  • 107
  • 1
  • 1
  • 4
9
votes
3 answers

How can I run redis on a single server on different ports?

I'm using kue which uses node_redis, but I'm also already using node_redis for my sessions, so I'd like to have kue create a server on a specific port say the default 6379 and then kue listen on port 1234. How would I be able to do this? I found…
bob_cobb
  • 2,229
  • 11
  • 49
  • 109
9
votes
2 answers

how can I get sessions to work using redis, express & socket.io?

So I am trying to get Sessions to work inside my socket.on('connection', ...) I am trying to get this working using recent versions: Socket.io - 0.9.13, Express - 3.1.0 and latest versions of other modules. Anyway I have tried using both modules…
Josh Mc
  • 9,911
  • 8
  • 53
  • 66
8
votes
4 answers

Redis redis.createClient() in Typescript

I was trying to connect Redis (v4.0.1) to my express server with typescript but having a bit issue. Am learning typescript. It's showing redlines on host inside redis.createClient() Can anyone help me out? const host = process.env.REDIS_HOST; const…
Robbi
  • 151
  • 2
  • 6
  • 14
8
votes
1 answer

Redis Upgrade from 3.0.7 to 5

I have plenty of Sentinel and Cluster servers running 3.0.7 and need to upgrade to 5. I cannot afford downtime. Can someone please advice me how to do it? Some DBs are so big that the servers cannot allocate a new/second instance in case of the best…
Jirene
  • 151
  • 3
  • 9
8
votes
2 answers

redis.lpush a number of items

In my node.js script I have an array of strings, and I want to LPUSH these strings into a Redis queue. I tried: var redis = require('redis').createClient(); redis.lpush('queue', ['1', '2', '3']) which results in a single string being pushed: redis…
akonsu
  • 28,824
  • 33
  • 119
  • 194
8
votes
1 answer

Atomic set only if not already set

Is there any way to do an atomic set only if not already set in Redis? Specifically, I'm creating a user like "myapp:user:user_email" and want Redis to give me back an error if "user_email" is already taken, instead of silently replacing the old…
Aaron Yodaiken
  • 19,163
  • 32
  • 103
  • 184
7
votes
13 answers

Node Redis does not work on my windows computer even though the server is up and running

const express = require("express"); const redis = require("redis"); const app = express(); const client = redis.createClient({ url: "redis://admin123@ec2-35-182-15-126.ca-central-1.compute.amazonaws.com", }); client.on("connect", function () { …
Codedeyya
  • 351
  • 1
  • 3
  • 7
7
votes
1 answer

Redis: ERR wrong number of arguments for 'auth' command

I'm using redis with nodejs. Version: "redis": "^3.1.2" When my server connects to redis, I get the following error: ERR wrong number of arguments for 'auth' command I'm guessing it has something to do with the URL, which looks like…
denislexic
  • 10,786
  • 23
  • 84
  • 128
7
votes
4 answers

ReplyError: MOVED error after connecting to Redis Cluster AWS

I am building a nodejs app that connects to redis. I have this working with my local instance of redis. Now, I am using ioredis to connect from my nodejs app to my redis cluster in k8s in AWS. Here is what I have. const Redis =…
afriedman111
  • 1,925
  • 4
  • 25
  • 42
7
votes
1 answer

How to subscribe a Redis channel from a React Component

How can I subscribe a redis channel inside a React Component when it is mounted (i.e, inside the componentDidMount() ) ? In the internet almost everywhere I see the redis implementation with nodejs but can't find any sufficient hints how to use…
Shamim
  • 635
  • 2
  • 12
  • 28
7
votes
2 answers

Connecting to both master and slave in a replicated Redis cluster

I'm setting up a simple 1 Master - N Slaves Redis cluster (low write round, high read count). How to set this up is well documented on the Redis website, however, there is no information (or I missed it) about how the clients (Node.js servers in my…
Nepoxx
  • 4,849
  • 5
  • 42
  • 61
7
votes
3 answers

How to store array of objects in Redis?

I have an array of Objects that I want to store in Redis. I can break up the array part and store them as objects but I am not getting how I can get somethings like {0} : {"foo" :"bar", "qux" : "doe"}, {1} : {"name" "Saras", "age" : 23} and then…
Saras Arya
  • 3,022
  • 8
  • 41
  • 71
7
votes
1 answer

Understanding web caching (Redis)

I'm working on a web app that receives data from an API provider. Now I need a way to cache the data to save from calling the provider again for the same data. Then I stumbled on Redis which seems to serve my purpose but I'm not 100% clear about the…
Seong Lee
  • 10,314
  • 25
  • 68
  • 106
7
votes
1 answer

one to one chat app with node.js, socket.io and redis

I currently have a chat application(one to one) in node.js and socket.io. as the users in my website are increasing, i want to introduce redis in my chat app. Here is a small example of my current app: // all requires and…
user3455531
  • 775
  • 1
  • 14
  • 28
1 2
3
50 51