Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!