Ioredis: [ioredis] Unhandled error event: ReplyError: NOAUTH Authentication required.

Created on 1 Dec 2017  路  3Comments  路  Source: luin/ioredis

I have the following configuration:

  • 1 redis master setup with 3 redis slaves in replication and with auth enabled

  • 3 redis sentinel instances configured with the master/slave setup for failover

My configuration works well and I am able to access either my master or any of the slaves. I have also tested failover, and it works well.

Now, I would like to connect to my sentinel using ioredis and I am experiencing some issue.
As mentioned in the documentation, I used the following snippets (with or without password) to connect to my redis sentinel:

var Redis = require('ioredis');
var redis = new Redis({
  sentinels: [{ host: 'redis-sentinel', port: 26379, password: "My-highly-secured-password" }],
  name: 'mymaster'
});
redis.set('foo', 'toto');
redis.get('foo', function (err, result) {
  console.log(result);
});
var Redis = require('ioredis');
var redis = new Redis({
  sentinels: [{ host: 'redis-sentinel', port: 26379 }],
  name: 'mymaster'
});
redis.set('foo', 'toto');
redis.get('foo', function (err, result) {
  console.log(result);
});

But in both the two cases, I end up with the same error:

[ioredis] Unhandled error event: ReplyError: NOAUTH Authentication required.

Does that mean that it is impossible to connect to a sentinel setup with auth enabled redis master/slaves instances using ioredis library?

Most helpful comment

You can still passes password option as how you connect to a single redis instance:

var redis = new Redis({
  sentinels: [{ host: 'redis-sentinel', port: 26379 }],
  password: "My-highly-secured-password",
  name: 'mymaster'
});

However, it's required that all your redis instances' password are same.

All 3 comments

You can still passes password option as how you connect to a single redis instance:

var redis = new Redis({
  sentinels: [{ host: 'redis-sentinel', port: 26379 }],
  password: "My-highly-secured-password",
  name: 'mymaster'
});

However, it's required that all your redis instances' password are same.

Thank you guy for your response, @luin
Tested and it works fine.

If you've set password for both sentinel and redis nodes, like in bitnami helm chart

var redis = new Redis({
  sentinels: [{ host: 'redis-sentinel', port: 26379 }],
  password: "My-highly-secured-password",
  sentinelPassword: "My-highly-secured-password",
  name: 'mymaster'
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

saschaishikawa picture saschaishikawa  路  4Comments

hzxuzhonghu picture hzxuzhonghu  路  5Comments

iamjochem picture iamjochem  路  5Comments

jehy picture jehy  路  4Comments

dfee picture dfee  路  4Comments