redis getaddrinfo ENOTFOUND - node.js , redis connection
Asked Answered
J

1

8

Hi im trying to connect to redis from node.js which is successful, now i hosted my node.js server app on amazon ec2 instance and redis on amazon elastic cache instance the connection to redis is succesful but once in a while i'm getting the below mentioned error.

var pub = redis.createClient(6379,'quizredis.qnsdtp.0001.apse1.cache.amazonaws.com'); 


events.js:72
    throw er; // Unhandled 'error' event
          ^       Error: Redis connection to quizredis.qnsdtp.0001.apse1.cache.amazonaws.com:6379 failed - getaddrinfo ENOTFOUND
at RedisClient.on_error (/home/ec2-user/roomChat-7/node_modules/redis/index.js:196:24)
at Socket.<anonymous> (/home/ec2-user/roomChat-7/node_modules/redis/index.js:106:14)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:813:16

Im using the redis-npm module;

Jocundity answered 21/11, 2014 at 7:47 Comment(5)
Ever get a response to this? I am getting the same issue.Escapade
I just got the same errorKellam
I got this as well - I ended up just connecting by IP, which has it's own problems but at least avoids this one.Vann
@Jocundity did you get a solution to this? Getting the same issue while connecting to EC2 instance.Audsley
saaaaaaaaaaaaaaaaamePensionary
D
0

From what I understand, this is a DNS resolution error. Elasticache Redis is a VPC specific service. Its DNS records are available within the VPC only and often times, VPC is using custom DHCP options with custom DNS server - it may not have the records.

Check a few things -

  1. DNS server configured in your VPC. Check here.
  2. Check the output of nslookup command in your machine - if your using linux shell

nslookup quizredis.qnsdtp.0001.apse1.cache.amazonaws.com

Cheers!

Doretheadoretta answered 29/4, 2022 at 17:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.