Reputation: 7225
Unable to connect with redis server installed on remote ubuntu machine.
I am trying:-
redis = Redis.new(url: "redis://<remote ubuntu server name>:<remote ubuntu server password>@<IP address of server>:6379/1")
redis.auth("<redis password>")
Getting the below error. Not sure how to pass all the details correctly.
: WRONGPASS invalid username-password pair or user is disabled. (redis://XXXX:6379/1) (Redis::CannotConnectError)
/usr/local/bundle/gems/redis-client-0.23.0/lib/redis_client/connection_mixin.rb:71:in call_pipelined': WRONGPASS invalid username-password pair or user is disabled. (redis://XXXX:6379/1) (RedisClient::AuthenticationError) from /usr/local/bundle/gems/redis-client-0.23.0/lib/redis_client.rb:779:in
block in connect'
from /usr/local/bundle/gems/redis-client-0.23.0/lib/redis_client/middlewares.rb:16:in call' from /usr/local/bundle/gems/redis-client-0.23.0/lib/redis_client.rb:778:in
connect'
from /usr/local/bundle/gems/redis-client-0.23.0/lib/redis_client.rb:740:in raw_connection' from /usr/local/bundle/gems/redis-client-0.23.0/lib/redis_client.rb:705:in
ensure_connected'
from /usr/local/bundle/gems/redis-client-0.23.0/lib/redis_client.rb:300:in call_v' from /usr/local/bundle/gems/redis-5.3.0/lib/redis/client.rb:90:in
call_v'
from /usr/local/bundle/gems/redis-5.3.0/lib/redis.rb:152:in block in send_command' from /usr/local/bundle/gems/redis-5.3.0/lib/redis.rb:151:in
synchronize'
from /usr/local/bundle/gems/redis-5.3.0/lib/redis.rb:151:in send_command' from /usr/local/bundle/gems/redis-5.3.0/lib/redis/commands/connection.rb:13:in
auth'
from (irb):51:in <main>' from /usr/local/bundle/gems/irb-1.14.1/lib/irb/workspace.rb:121:in
eval'
from /usr/local/bundle/gems/irb-1.14.1/lib/irb/workspace.rb:121:in evaluate' from /usr/local/bundle/gems/irb-1.14.1/lib/irb/context.rb:622:in
evaluate_expression'
from /usr/local/bundle/gems/irb-1.14.1/lib/irb/context.rb:590:in `evaluate'
... 26 levels...
Upvotes: 0
Views: 136
Reputation: 4332
This is probably your call to redis.auth
.
If you have ACLs enabled for Redis, the behavior of the AUTH command expects both a username and a password to be passed to it. If you don't provide both arguments, it assumes that the user is named default
. Which is probably not your username.
I you don't have ACLs enabled, Redis doesn't have a concept of a user and only has a password. In that case the AUTH command takes a single argument, which is the password.
If you were given a username and password to connect to Redis, you probably have ACLs enabled. So, you need to pass in both the username and password. I do not know if you Ruby client you are using supports this or not.
However, there's and easier fix. Just remove the call to redis.auth
. You have the username and password in your Redis URL already so you don't need to call redis.auth
.
Upvotes: 0