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

待修复 #41

Closed
pp292 opened this issue Sep 4, 2024 · 7 comments
Closed

待修复 #41

pp292 opened this issue Sep 4, 2024 · 7 comments

Comments

@pp292
Copy link

pp292 commented Sep 4, 2024

版本
go 1.22.2

github.com/kitex-contrib/registry-etcd v0.2.4

服务注册 etcd.NewEtcdRegistryWithRetry 链接etcd一定要设置 etcd.WithEtcdServicePrefix(""),否则默认的Prefix: "kitex/registry-etcd"形同虚设。

默认不设置 etcd.WithEtcdServicePrefix 情况下,服务注册并没有设置 kitex/registry-etcd 前缀,而client去请求找etcd服务的时候,又会根据 kitex/registry-etcd 前缀去找。

导致一直出错,提示 service discovery error: no instance remains for XXXX

@DMwangnima
Copy link
Contributor

方便看一下你在 server 侧的代码么?

@pp292
Copy link
Author

pp292 commented Sep 5, 2024

retryConfig := retry.NewRetryConfig(
	retry.WithMaxAttemptTimes(config.MaxAttemptTimes)),
	retry.WithObserveDelay(config.ObserveDelay*time.Second),
	retry.WithRetryDelay(config.RetryDelay*time.Second),
)
r, err = etcd.NewEtcdRegistryWithRetry(config.Hosts, retryConfig)

这个代码会出现错误,但是设置前缀后正常了。

retryConfig := retry.NewRetryConfig(
	retry.WithMaxAttemptTimes(config.MaxAttemptTimes)),
	retry.WithObserveDelay(config.ObserveDelay*time.Second),
	retry.WithRetryDelay(config.RetryDelay*time.Second),
)
r, err = etcd.NewEtcdRegistryWithRetry(config.Hosts, retryConfig, etcd.WithEtcdServicePrefix(""))

使用 /usr/local/etcd/etcdctl get "" --prefix --keys-only 看过注册的服务,确实是新注册的服务没有kitex/registry-etcd前缀

@GuangmingLuo
Copy link
Member

@pp292 请遵守社区守则,友善反馈问题,我们不欠你啥,“巨坑”是啥意思?开源项目使用过程中遇到问题提出问题解决问题即可。

@DMwangnima
Copy link
Contributor

@pp292 这里确实遗漏了注入 prefix 到 etcdRegistry 中
image
有兴趣提个 PR 修复下么?
另外可以修改一下 issue 标题么,我们的 kitex-contrib 项目是社区同学在百忙中抽出时间贡献得到的,“巨坑”确实有些言重了。

@pp292
Copy link
Author

pp292 commented Sep 5, 2024

@pp292 这里确实遗漏了注入 prefix 到 etcdRegistry 中 image 有兴趣提个 PR 修复下么? 另外可以修改一下 issue 标题么,我们的 kitex-contrib 项目是社区同学在百忙中抽出时间贡献得到的,“巨坑”确实有些言重了。

你的回复比较客观,不像有些同学。

@pp292 pp292 changed the title 巨坑 待修复 Sep 5, 2024
@DMwangnima
Copy link
Contributor

@pp292 v0.2.5 已修复这个问题,请试用一下。如果 ok 的话,这个 issue 可以 close 了。

@li-jin-gou
Copy link
Contributor

li-jin-gou commented Sep 9, 2024

这个 PR 引入的 bug #34 cc @logicwu0

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

No branches or pull requests

4 participants