如题, 在使用 ioredis
链接 redis
的哨兵是,报错 All sentinels are unreachable
, 代码示例如下:
const Redis = require('ioredis');
let redis = new Redis({
sentinels: [
{ host: 'XXX', port: XX },
{ host: 'XXX', port: XX },
{ host: 'XX', port: XX },
],
name: 'mymaster',
connectTimeout: 1000,
});
redis.select(1);
// console.log(redis);
redis.set('foo', 'hello world');
redis.get('foo', (err, result) => {
console.log(result);
})