Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
Redis Client ignoring configuration options set on it and trying to connect to default ip 127.0.01

In AWS i am using ElastiCache Redis server and using node as backEnd and "promise-redis" package

this is how i am tried to do to connect to my redis server endpoint

client = redis.createClient({
        host: '**my redis primary endpoint**',
        port: 6379
    });

this worked for a while but after adding some lines of code not related to redis it gave me this error

error: connect ECONNREFUSED 127.0.0.1:6379

it seems trying to connect to the local server and ignoring the host endpoint i gave to him

and when i changed the port to any number like 6300

it gave the same error with the default port number too

error: connect ECONNREFUSED 127.0.0.1:6379

i am so confused please help !!!!

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

these "geniuses" changed such a significant thing in their library as the connection and didn't even give a good warning about it. I'm already silent about the fact that it is a crime to make such changes when your library in a million projects is already coded. Now you need to connect like this:

const client = redis.createClient({
  socket: {
    host,
    port
  },
  password
});

I advise you to switch to the ioredis library, there is an old api, only the client is created through new Redis ({old config})

Because in this old library ("redis"), for some reason they now require an asynchronous connect () for some functionality, without really explaining why and when it is needed, and when it is not needed. Half of the code works for me, and half does not. So, use better this:

let Redis = require('ioredis');
  const client = new Redis({
  host: '***',
  port: ****,
  password: '****'
});
over 4 years ago · Santiago Trujillo Relatório

0

Make sure the host key does not have the protocol part "http://" in it

client = redis.createClient({ 
    host: '192.168.45.34', // don't use host: 'http://192.168.45.34'
    port: 6379 
});

If you include the protocol in your host key, the redis client defaults to using localhost - 127.0.0.1

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda