Skip to content

仅添加权限认证代码,未修改其他任何东西 #16

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/resty/rediscluster.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local ffi = require 'ffi'


local ngx = ngx
local ffi_new = ffi.new
local C = ffi.C
local crc32 = ngx.crc32_short
Expand Down Expand Up @@ -135,6 +135,7 @@ function _M.fetch_slots(self)
local ip = serv_list[i].ip
local port = serv_list[i].port
local ok, err = red:connect(ip_string(ip), port)
local ok, err = red:auth(self.config.auth)
if ok then
local slot_info, err = red:cluster("slots")
if slot_info then
Expand All @@ -150,8 +151,6 @@ function _M.fetch_slots(self)
end
end
slot_cache[self.config.name] = slots
--self.slots = slots
--debug_log("fetch_slots", self)
end
end
end
Expand All @@ -171,6 +170,7 @@ function _M.new(self, config)
inst.config = config
inst = setmetatable(inst, mt)
inst:init_slots()

return inst
end

Expand Down Expand Up @@ -211,6 +211,7 @@ local function _do_cmd(self, cmd, key, ...)
local port = serv_list[index].port
local redis_client = redis:new()
local ok, err = redis_client:connect(ip_string(ip), port)
local ok, err = redis_client:auth(self.config.auth)
if ok then
slots[slot].cur = index
local res, err = redis_client[cmd](redis_client, key, ...)
Expand Down