At the moment (up to and including v4), Redis doesn't support users and only provides authentication against a global password. In order to be compliant with the URI RFC ( https://www.rfc-editor.org/rfc/rfc3986 ) and based on the provisional RFC for Redis URIs ( https://www.iana.org/assignments/uri-schemes/prov/redis ), you can pass anything as a username, including the empty string, and it will be okay (i.e. ignored). P.S. thanks for bringing up this obscurity in our docs, I'll see that it is amended.
4条答案
按热度按时间o2gm4chl1#
我使用golang(https://github.com/garyburd/redigo)并连接到阿里云Redis(链接:(https://www.aliyun.com/product/kvstore?spm=5176.8006303.267657.7.cW2xH)
通过连接字符串:
redis://任意用户名:密码@ IP地址:6379/0
当0是数据库索引且成功时
dfuffjeb2#
At the moment (up to and including v4), Redis doesn't support users and only provides authentication against a global password. In order to be compliant with the URI RFC ( https://www.rfc-editor.org/rfc/rfc3986 ) and based on the provisional RFC for Redis URIs ( https://www.iana.org/assignments/uri-schemes/prov/redis ), you can pass anything as a username, including the empty string, and it will be okay (i.e. ignored).
P.S. thanks for bringing up this obscurity in our docs, I'll see that it is amended.
j91ykkif3#
default
用户身份进行身份验证),或者您使用的是旧版本的Redis,那么您应该在Redis URL中省略用户名(例如:redis://rediscloud:mypassword@...
→redis://:mypassword@...
)rediscloud
,而您的示例没有在ACL中配置该用户,那么随着越来越多的Redis客户端库实现ACL支持,您可能会遇到WRONGPASSWORD
错误的授权问题。qyswt5oh4#
当需要SSL时,此格式适用于我:
示例如下: