Hello!
On Tue, Sep 23, 2014 at 4:43 AM, amitabh.mehra wrote:
> Thanks for the input. I tried using the sentinel functions. That worked but
> I had to add resolver directive. Surprisingly, upstream redis servers
> configured work with redis2_pass without the resolver directive. Do you what
> is the difference?
>
If you specify static domain names in nginx.conf, then nginx just uses
the blocking system resolver to resolve it. But if you use domain
names in your Lua code, then we have to use nginx's own nonblocking
resolver to resolve them because your Lua code has not yet run during
nginx configuration loading.
> Also, I was trying to use
> connector.connect_via_sentinel(sentinels, master_name, try_slaves,
> options)
> but have not been able to get it working with multiple sentinels
> (x.x.x.x:26379, x.x.x.x:26380, x.x.x.x:26381). How should this be passed to
> the api?
>
You need James Hurst to answer that or just read this function's Lua
implementation.
> Can the result (master server) be cached (proxy_cache???)
>
You surely cannot use proxy_cache to cache redis level metadata. The
proxy_cache is designed to cache HTTP responses served by the
ngx_proxy module. For Lua land caching, you have many options, for
example, the shm-based lua_shared_dict thing [1] or Lua-VM level
caching based on lua-resty-lrucache [2].
Regards,
-agentzh
[1] https://github.com/openresty/lua-nginx-module#lua_shared_dict
[2] https://github.com/openresty/lua-resty-lrucache