Can I dynamically lists all servers backend using lua scripts ? For Example:
Lua Script:
local function choose_backend()
return “server webserver02 lbwebserver-02.perf.lokal:80 check”
end
core.register_fetches(“choose_backend”, choose_backend)
HA Configuration:
global
....
lua-load /usr/sbin/lua-choose-backend.lua
defaults
....
frontend WEBSERVERS
bind 172.18.69.116:9000
use_backend WEBSERVER01
backend WEBSERVER01
%[lua.choose_backend]
I had tried that thing, but haproxy says invalid ‘%’ thing.
I don’t want to use the ‘use_backend’ like internet says, because If I use that way, I would have to add the backends everytime my servers grow. I want to dynamically list those servers on the lua
Is that possible ?