项目使用的是redis元数据中心,配置了密码,发现启动的时候元数据没有上报。
经调试发现,RedisMetadataReport 构造函数里面没有解析 password , 奇怪的是 2.7.4.1 里面也有解析,是不是漏掉了?发现那2.7.7版本也没有
在 RedisMetadataReport 构造函数加上
password = url.getParameter(PASSWORD_KEY, "");
It depends.
Precondition: redis-server auth enabled.
<!-- Good -->
<dubbo:metadata-report address="redis://username:[email protected]:6379"/>
<!-- Bad -->
<dubbo:metadata-report address="redis://127.0.0.1:6379" username="username" password="redis"/>
The bad one throws:
redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
at redis.clients.jedis.Protocol.processError(Protocol.java:127)
at redis.clients.jedis.Protocol.process(Protocol.java:161)
at redis.clients.jedis.Protocol.read(Protocol.java:215)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239)
at redis.clients.jedis.Jedis.set(Jedis.java:121)
...
It seems MetadataReportConfig#toUrl didn't set the username&password to the proper field of the url. Therefore the constructor of RedisMetadataReport gets no password with url.getPassword(), which hides in url.getParameter("password").
Replace implementation of MetadataReportConfig#toUrl with method UrlUtils.parseURL(address, map) from same situation in ConfigCenterConfig#toUrl should resolve this problem.

I will add a redis client module to handle the interact with redis server, meanwhile solve the problem
@tswstarplanet Do you have time to work on this?
@spilledyear
在配置 redis 作为 Dubbo 项目的元数据中心时, 我也遇到了同样的问题, 报错如下
redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.
我的项目环境是
在配置文件里用下面这种格式
dubbo.metadata-report.address=redis://username:[email protected]:6379
或者
<dubbo:metadata-report address="redis://username:[email protected]:6379"/>
根据报错 debug 到 org.apache.dubbo.common.URL 这个类里

Most helpful comment
@spilledyear
在配置 redis 作为 Dubbo 项目的元数据中心时, 我也遇到了同样的问题, 报错如下
我的项目环境是
解决方法如下:
在配置文件里用下面这种格式
或者
根据报错 debug 到 org.apache.dubbo.common.URL 这个类里