Introduction
Client-side cluster support helps your application talk to the right Redis server in a group, so data is stored and found quickly.
Use a Redis client library that supports cluster mode.
Connect using the cluster's startup nodes.
The client automatically routes commands to the right server.redis-cli -c -p 7000const Redis = require('ioredis'); const cluster = new Redis.Cluster([ { host: '127.0.0.1', port: 7000 }, { host: '127.0.0.1', port: 7001 }, { host: '127.0.0.1', port: 7002 } ]); cluster.set('key', 'value'); cluster.get('key').then(console.log);
redis-cli -c -p 7000 set user:1 "Alice" get user:1
const client = redis.createClient({ cluster: true, nodes: [ { port: 7000 }, { port: 7001 } ] });
await client.connect();
await client.set('key1', 'value1');
const val = await client.get('key1');
console.log(val);const client = redis.createClient({ cluster: true, nodes: [ { port: 7000 } ] });
await client.connect();
What is the most likely cause?Pass the test and this pattern moves unknown