Redis reports Error getaddrinfo ENOTFOUND

Well, well, this error is common and not common, it is a low-level problem.

Recap


Today I have a requirement that I need to retransmit the online official environment data, and I need to fine-tune the data.
So, I decided to run the program locally, link the online official environment database and redis, and get some data.

Next, the problem came. After the official redis configuration was placed in the local environment, redis could not be connected.

illustrate


  • Environment: node+ioredis
  • Phenomenon: redis connection error, error Error: getaddrinfo ENOTFOUND {host}
  • Analysis: According to the error message, the current redis connection address does not exist;
  • Question: This redis address is copied from the official environment configuration. It is certain that the connection address is valid, but now it cannot be connected locally;
  • picture

Error message:

Redis: Fail
Error: getaddrinfo ENOTFOUND 

insert image description here

solution:


  • 1. Check if there are any less copy characters in your connection address;
  • 2. Check whether the link address is a public network address. I have this problem because the address is an intranet address. If it is an internal network address, you need to change it to a public network address by yourself, and you can use it!

think


Actually, this question is not very difficult. Just looking at the error message, you can understand that there must be a problem with the redis configuration, but where the problem is needs to be determined.

As can be seen from the figure below, there are not many configuration parameters, so the problem is easy to locate.

  • First of all, compare these parameters to see if the copy is wrong.
  • Whether there is no VPN connection (the company has a LAN test environment), since the redis link address is in the official environment and belongs to Alibaba Cloud, so this directly passes;
  • Finally, check whether the redis link address is a public network address. There is a silly trick here. If you get the public network address of Alibaba Cloud's redis, no one will not set a password. So, take a bold look at the dev commits and ask the developers.

insert image description here

Fudao message

Haven't written a note yet? What are you forcing the child into?

Guess you like

Origin blog.csdn.net/Long861774/article/details/126719188