Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add multiple host dynamic by lua code. #2

Open
mdsohelmia opened this issue Aug 3, 2022 · 1 comment
Open

How to add multiple host dynamic by lua code. #2

mdsohelmia opened this issue Aug 3, 2022 · 1 comment

Comments

@mdsohelmia
Copy link

No description provided.

@leandromoreira
Copy link
Owner

leandromoreira commented Aug 4, 2022

I don't know if I got you right, but you can use Lua to add dynamically hosts using https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md . There is in even a consistent hashing implementation https://github.com/openresty/lua-resty-balancer

You can update a shared list of dynamic hosts by having a background Lua task polling the hosts/ips you need to use. You'll need to pay attention to how you deal with health check as well.

BEWARE on how nginx/lua resolves name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants