apache / incubator-seata

:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
https://seata.apache.org/
Apache License 2.0
25.25k stars 8.77k forks source link

bug: setting up a Raft cluster using domain, the listening request port is error #6551

Closed zacharias1989 closed 3 months ago

zacharias1989 commented 4 months ago

Ⅰ. Describe what this PR did

raft模式,客户端watch集群时,会使用解析后的IP地址查询raft节点。 如果客户端配置中使用域名,则无法用IP找到节点,导致获取http端口号错误。 这里修改为使用域名。 修改后,如果环境中存在DNS(如在k8s等环境中),需要优先使用域名,否则仍会出现匹配问题。 建议后续修改METADATA的数据结构,保存DNS解析结果,避免在queryHttpAddress中重复解析node地址。

Ⅱ. Does this pull request fix one issue?

fixes #6532

Ⅲ. Why don't you add test cases (unit test/integration test)?

修改内容较少,如果环境中不存在DNS,不造成任何影响

Ⅳ. Describe how to verify it

在k8s环境中直接使用集群内部域名时,个人已验证

Ⅴ. Special notes for reviews

由于METADATA中只记录了原始节点信息,不区分域名或IP,所以无法确保比较结果。 如果直接在queryHttpAddress解析原始节点信息会造成不必要的网络压力和性能损失。 要彻底修复该问题,建议修改METADATA中的节点信息,解析并保存DNS解析结果,避免在queryHttpAddress中重复解析。

zacharias1989 commented 4 months ago

已在queryHttpAddress方法中解析了node,统一使用IP,无论使用IP还是域名都可以正确运行