Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to send commands to sentinel #1947

Open
mkl262 opened this issue Jan 21, 2025 · 0 comments
Open

unable to send commands to sentinel #1947

mkl262 opened this issue Jan 21, 2025 · 0 comments

Comments

@mkl262
Copy link

mkl262 commented Jan 21, 2025

Hi,

Im using ioredis to connect to a sentinel server, and Im able to run all redis commands successfully. But when I try to run commands on sentinel, I get an error (see below). I also ran wireshark on my computer while running the code, and I saw that the sentinel command is sent to the redis master ip. Is there something wrong that I did?

code:

const Redis = require('ioredis');

const redis = new Redis({
  sentinels: [{ host: 'localhost', port: 26379 }],
  name: 'myMaster', // The name of your master (as configured in Sentinel)
});

redis.on('connect', () => {
  console.log('Connected to Redis Sentinel');
});

// Get master address and print it
redis.sentinel('masters', (err, masters) => {
  if (err) {
    console.error('Error getting masters:', err);
  } else {
    console.log('Masters:', masters);
  }
});

error:

Connected to Redis Sentinel
Error getting masters: ReplyError: ERR unknown command 'sentinel', with args beginning with: 'masters' 
    at parseError (/Users/michael/Documents/Widebridge/synch-common/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/Users/michael/Documents/Widebridge/synch-common/node_modules/redis-parser/lib/parser.js:302:14) {
  command: { name: 'sentinel', args: [ 'masters' ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant