openresty / lua-resty-mysql

Nonblocking Lua MySQL driver library for ngx_lua or OpenResty
708 stars 236 forks source link

Mysql DNS backend are multi-servers,then failed to connect #81

Open dyrone opened 6 years ago

dyrone commented 6 years ago

XXX.svn.xxxx.net is my mysql connection DNS. The XXX.svn.xxxx.net behiding are two different servers (two IP) So when i connection to it ,there execption get out : Failed to connect: XXX.svn.xxxx.net could not be resolved (3: Host not found): nil nil, client: XXX.XXX.XXX.XX

by LOG PRINTER : ngx.log(ngx.WARN,"1: ", err, ": ", errcode, " ", sqlstate)

agentzh commented 6 years ago

@dyrone Seems like you forgot to configure the resolver directive in your nginx.conf? See

http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver