ledgetech / lua-resty-redis-connector

Connection utilities for lua-resty-redis
234 stars 71 forks source link

I found 127.0.0.1 is not in slaves,dose it exist anathor way to choose lolalhost?? #22

Open hyhy01 opened 6 years ago

hyhy01 commented 6 years ago
if main_host then
            local function sort_by_main_host(a, b)
                if a.host == main_host and b.host ~= main_host then
                    return true
                else
                    return false
                end
            end
            tbl_sort(slaves, sort_by_main_host)
        else
            -- Put any slaves on 127.0.0.1 at the front
            tbl_sort(slaves, sort_by_localhost)
        end

AND can choose master or slave to connect via command ?