nrk/redis-lua

missing password parameter in the connection

aztrock opened this issue · 5 comments

missing password parameter in the connection

you can use client:auth(password)

redis = require 'redis'
client = redis.connect('127.0.0.1', 6379)
client.auth(password)
/usr/local/share/lua/5.1/redis.lua:371: attempt to index field 'network' (a nil value)
stack traceback:
/usr/local/share/lua/5.1/redis.lua:371: in function 'send'
/usr/local/share/lua/5.1/redis.lua:379: in function 'auth'
stdin:1: in main chunk
[C]: ?

client:auth, not client.auth

client:auth( password ) works for me, thanks a lot!

Hey guys, there are a few different ways to authenticate with redis lua and the method shown above is just one of them.

When we configure redis to require a password by changing the redis.conf file and uncommenting the requirepass flag (# requirepass foobared) we use the auth method as below.

redis = require 'redis'
local password = 'mypass'
client = redis.connect('127.0.0.1', 6379)
client:auth(password)

However, if we use the acl with a username and password, we must authenticate as follows.

redis = require 'redis'
local password = 'mypass'
local user = 'myuser'
client = redis.connect('127.0.0.1', 6379)
client:auth(user, password)

I left some links to help if anyone is facing the same difficulties I went through

https://redis.io/commands/auth/
https://redis.io/docs/management/security/acl/