- Documentation
Cache for Redis
FAQ
Errors and exceptions
Why does it prompt "failed to connect: no resolver defined to resolve" when I use Nginx Lua to connect to Redis?
Errors and exceptions
Why does it prompt "failed to connect: no resolver defined to resolve" when I use Nginx Lua to connect to Redis?
Why does it prompt "failed to connect: no resolver defined to resolve" when I use Nginx Lua to connect to Redis?
Problem phenomenon
When accessing an instance through Nginx + Lua by using the address domain name of Redis, some error messages appear, such as failed to connect: no resolver defind to resolve. They prompt that the address cannot be resolved properly.
tip
When you use other clients or ECS to access Redis instances through addresses, similar error messages related to failed domain name resolution may appear (For example, Temporary failure in name resolution or Could not connect to Redis: No address associated with hostname). If they prompt that the address cannot be resolved properly, refer to the solutions in this article to deal with the problem.
Possible cause
The cause of the above errors may be that the DNS settings in the Nginx profile are incorrect, which results in failed address resolution. Check the Redis address domain name. Check whether the DNS settings in the Nginx profile are correct.
For Nginx 0.6.18 and later versions, when using variables to construct server addresses, use the resolver command to specify the DNS server address.
Solution
tip
This article takes the Linux environment as an example to introduce relevant solutions.
- Check whether the Redis address set in the business code is correct.
- Log on to the Redis console to view the address and port number of the target Redis instance. For specific procedures, refer to Viewing connection address.
- Confirm the DNS server settings in the profile nginx.conf of Nginx. Add the DNS server information of the Volcano Engine to the profile with the following command.
tip
- Nginx is used as an example in this article. You can modify the DNS server settings of the client or ECS in use based on your actual business.
- 100.96.0.2 and 100.96.0.3 are DNS servers used by Volcano Engine.
resolver 100.96.0.2,100.96.0.3;
Last updated: 2025.11.04 21:37:55