How to connect my node.js backend application with aws elasticache redis cluster?

1

I have a redis cluster after using that in my node.js backend code it is giving 'ENOTFOUND' error, my backend deployed in ECS docker.

can anyone please help me on why i am getting this error?

  • Are you using route 53 at any point in the setup? I ran into similar issues in the past where my ECS containers were using only the private hosted zone of my domain. So I had to duplicate my public records into my private zone and that resolved it.

  • Can you update your post with code, which shows the way that you are connecting to redis?

  • This is my code on node.js;

    var redis = require("redis"); ////const redis = require('redis'); // const client = redis.createClient({ // host:'redis endpoint url', // port:6379, // }); // client.on("error", function (error) { // console.error("Error encountered:", error); // }); // client.on("connect", function (data1) { // console.log("Redis Connection Established"); // })

    errors: Error : Error: Redis connection in broken state: connection timeout exceeded.

已提問 1 年前檢視次數 681 次
1 個回答
2

connection timeout means a connectivity issue. You need to make sure that NACL and Security Group allows ECS to connect to the Redis. In case when your Redis and ECS are in different VPCs, you also need to configure a peering and routing between them.

profile picture
專家
已回答 1 年前
profile picture
專家
Artem
已審閱 1 個月前
  • ecs security group is added in inbound rule of redis security group, but still same issue is persiting, am i writing code wrong way?

    This is my code on node.js;

    var redis = require("redis"); ////const redis = require('redis'); // const client = redis.createClient({ // host:'redis endpoint url', // port:6379, // }); // client.on("error", function (error) { // console.error("Error encountered:", error); // }); // client.on("connect", function (data1) { // console.log("Redis Connection Established"); // })

    error : errno: 'ENOTFOUND',

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南