openresty / lua-resty-balancer

A generic consistent hash implementation for OpenResty/Lua
322 stars 77 forks source link

[Question] Is there any way to get the ips from DNS? #43

Open rjshrjndrn opened 2 years ago

rjshrjndrn commented 2 years ago

Hi, Thank you for this awesome plugin. I have got a specific scenario. I'm trying to DNS Loadbalance (sticky sessions) a websocket service. I've tried with static IPs, and this plugin works beautifully. Unfortunately, I'm a noob in lua. Is there any way to integrate this solution with the dns queries, rather than giving static ips. Any suggestions are highly appreciated.

Regrads.

xiaocang commented 2 years ago

maybe you could use https://github.com/openresty/lua-resty-dns

rjshrjndrn commented 2 years ago

Thank you @xiaocang for your response. I saw this plugin while trying to solve the issue. But I couldn't get my head around how to use the DNS plugin for host queries and return the result to this plugin. My concerns are, each time, If I call the DNS plugin, it's an expensive call. Then I'll have to implement some kind of LRU logic, or resolver timeout something like that. I'm not that expert in Lua, as I mentioned earlier. This library seems like a good solution, But there is no getting started guide or code samples. :confused: :disappointed: