The redis gem allows user/password symbols to connect to a redis server?

使用宝石允许用户/密码符号连接到Redis服务器?

Tags: redis
标签: redis

问题 (Question)

I'm using the redis gem to make a connection to my own redis server without verify a valid user/password.

If I execute this:

require 'redis'

redis = Redis.new(:host => '33.33.33.10',
                  :port => '6379'
)

puts redis.inspect
puts redis.ping

The output is:

#<Redis client v3.0.7 for redis://33.33.33.10:6379/0>
PONG

All fine, no problems, but how can I use a combination of user and password to verify the valid credentials when a user try to connect to my server.??

I would appreciate a concrete example.

我用的redis宝石为了使连接到我自己redis服务器没有一个有效的用户名/口令的验证。

如果我执行这:

require 'redis'

redis = Redis.new(:host => '33.33.33.10',
                  :port => '6379'
)

puts redis.inspect
puts redis.ping

输出是:

#<Redis client v3.0.7 for redis://33.33.33.10:6379/0>
PONG

好,没有问题,但我怎么能结合使用用户名和密码来验证的有效凭证,当用户尝试连接到我的服务器。??

我会欣赏一个具体的例子。

最佳答案 (Best Answer)

See Redis Security: Redis is designed to be accessed by trusted clients inside trusted environments.

So basically you should do your own user login and only if you trust them, you can let them connect to your Redis server.

看到使用安全:使用可信任客户在受信任的环境中访问。

所以基本上你应该做你自己的用户登录,如果你信任他们,你可以让他们连接到Redis服务器。

本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:http://stackoverflow.com/questions/22021759