Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SentinelConnectionManager管理类中的NetUtil.createByteArrayFromIpAddressString(addr.getHost()) == null这个条件是不是有问题呢 #5858

Open
lcwlv929 opened this issue May 11, 2024 · 2 comments
Labels

Comments

@lcwlv929
Copy link

SentinelConnectionManager管理类中的NetUtil.createByteArrayFromIpAddressString(addr.getHost()) == null判断条件在什么时候为空,是不是应该写成不为空的时候
添加sentinelHosts.add(addr);
这方法的意思是哨兵地址的时候添加,还是没有哨兵地址的时候添加,

@lcwlv929
Copy link
Author

重新描述一下问题
应用redission连接哨兵,哨兵配置了三个地址,代码在调用到SentinelConnectionManager的public SentinelConnectionManager(SentinelServersConfig cfg, Config configCopy)方法时,for循环中可以获取到三个地址,但是在验证方法if (NetUtil.createByteArrayFromIpAddressString(addr.getHost()) == null && !addr.getHost().equals("localhost")) {
sentinelHosts.add(addr);
}
中,因为NetUtil.createByteArrayFromIpAddressString(addr.getHost()) 有返回值,不是空,
导致地址不能添加到哨兵地址中,最终会导致无法连接。
异常后系统会报org.redisson.client.RedisConnectionException Create breakpoint:SENTINEL SENTINELS command returns less than 2 nodes or connection can't be established to some of them!

@lcwlv929 lcwlv929 changed the title SentinelConnectionManager管理类中的NetUtil.createByteArrayFromIpAddressString(addr.getHost()) == null是什么意思呢 SentinelConnectionManager管理类中的NetUtil.createByteArrayFromIpAddressString(addr.getHost()) == null这个条件是不是有问题呢 May 11, 2024
@mrniko
Copy link
Member

mrniko commented May 13, 2024

Sorry, I don't understand the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants