ioRedis can't delete key in redis cluster
See original GitHub issueConfigurations
ioRedis@4.9.0 (cluster mode) connect-redis@3.4.1 express-session@1.15.6 Redis Server Version: 5
Errors
ReplyErrorredis-parser.lib:parser in parseError errorCROSSSLOT Keys in request don’t hash to the same slot
the Reply errors contains :
{ command: { args: [ sess:6BSHHdpoqDVhpqWuOqrunZcqsUadtSEn, ], name: del } }
My code
const express = require('express');
const session = require('express-session');
const Redis = require('ioredis');
redisClient = new Redis.Cluster([{ 'host': host, 'port': port }]);
const RedisStore = require('connect-redis')(session);
let sessionStore = new RedisStore({
client: redisClient
});
app.use(session({
secret: 'mysecret',
saveUninitialized: false,
resave: false,
store: sessionStore,
cookie: {
maxAge: 60 * 1000 // 1 minutes
}
}));
Logs
connect:redis DEL “Nu-53UpCkkG4XutUUFULWlWH_s-M2IU9” ioredis:redis write command[10.2.0.29:6379]: 0 -> del([ ‘sess:Nu-53UpCkkG4XutUUFULWlWH_s-M2IU9’, ‘’ ])
After seeing that I suppose that ioredis add a blank parameters and this is why it can’t delete my session key.
What is expected ?
I expect that my session key will be deleted in my redis cluster.
Thank in advance for your reply 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to delete keys matching a pattern in Redis Cluster
Answers for that question try to remove multiple keys in a single DEL . However, keys matching the given pattern might NOT locate...
Read more >DEL
When a key to remove holds a value other than a string, the individual complexity for this key is O(M) where M is...
Read more >ioredis
A robust, performance-focused and full-featured Redis client for Node.js.. Latest version: 5.2.4, last published: 2 months ago.
Read more >Redis Delete Key
Before we learn how to delete keys, let us first discuss creating keys and inserting data in Redis. Open the terminal and open...
Read more >How to Clear Redis Cache {Deleting All Keys or from ...
Redis is an open-source solution for storing key-value pairs. Here is how you can delete those keys and clear Redis cache.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in connect-redis@v3.4.2.
I’ve created a pull request on the connect-redis repo for this issue: https://github.com/tj/connect-redis/pull/272