Hi,

I'd like to change backend server by referring to the database. e.g. Redis
I cannot use server directive with the return of core.register_fetches. A 
parsing error occurs.
Do I cannot %[lua.xxx] in server directive on the specification?
Dose anyone have any idea?

Following are samples I'm trying.

---get_backend.lua----------
core.register_fetches('backend',"tcp", function(txn)
  local redis = require('redis')
  local client = redis.connect('192.168.0.10', 6379)
  return client:get(txn.sf:dst_port())
end)
-----------------------------------

---haproxy.cfg-----------------
global
  lua-load get_backend.lua

listen example
  mode tcp
  bind :30000-50000
  server MYSERVER %[lua.backend]
-----------------------------------

---ERROR CONTENT------
[ALERT] 194/145111 (21636) : parsing [haproxy.cfg:20] : 'server MYSERVER' : 
invalid address: '%[lua.backend]' in '%[lua.backend]
-----------------------------------

Best regards,
Takada

Reply via email to