You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my goal is use nignx can find the master redis and only be the proxy for that. my plan is find the master's IP by sentinel, and set the IP as a parameter that I can use that in stream to proxy_pass.
Can this module achieve it?
thanks!
I used the sentinel to connect, is the pod IP.
Also, how to use get_master method. my Code is
local rc = require("resty.redis.connector").new(redis)
local redis, err = rc:connect{
url = "sentinel://mymaster:a/2",
sentinels = {
{ host = "10.62.108.88", port = 32641 },
}
}
if not redis then
ngx.say("close redis error : ", err)
end
local master, err = require("resty.redis.sentinel").get_master(sentinels, master_name)
if not master then
ngx.say("close redis error : ", err)
end
I already changed the sentinels in the default table. like:
sentinels = {
{ host = "10.62.108.88", port = 32641 },
}
the Output is
2019/02/27 02:09:43 [error] 32187#32187: *46 lua tcp socket connect timed out, when connecting to 172.30.63.147:6379, client: 127.0.0.1, server: , request: "GET /lua_redis_basic HTTP/1.1", host: "localhost:800"
2019/02/27 02:09:43 [error] 32187#32187: *46 lua entry thread aborted: runtime error: ...y/lua-resty-redis-connector/lib/resty/redis/sentinel.lua:18: attempt to index local 'sentinel' (a nil value)
stack traceback:
coroutine 0:
...y/lua-resty-redis-connector/lib/resty/redis/sentinel.lua: in function 'get_master'
/usr/local/openresty/nginx/conf/test.lua:14: in function </usr/local/openresty/nginx/conf/test.lua:1>, client: 127.0.0.1, server: , request: "GET /lua_redis_basic HTTP/1.1", host: "localhost:800"
curl: (52) Empty reply from server
what can I do? Thanks! @pintsized @andrewsharpe @stockrt
The text was updated successfully, but these errors were encountered: