我是 go-micro 的新手,尝试让 micro server
在我的 docker-compose 设置中作为另一个服务运行,但是我的第一个微服务没有在 Micro Web 中显示(Go微型仪表板)。如果我在 docker-compose 外部运行 micro server
,我可以在仪表板中看到几个与 go-micro 相关的微服务,但在 docker-compose 内部没有显示。
我整理了一个示例代码来重现我的经历,我使用 micro new
生成了服务并且没有改变其中的任何内容,docker-compose.yml
反射(reflect)了我是如何在开始遇到这种情况的项目中进行设置的:
https://github.com/shackra/go-micro-docker-compose-bug
我做错了什么以及如何让 Micro 仪表板在 docker-compose 中按预期工作?
我在 docker compose 中添加了一个网络但没有任何运气,也使我的示例服务可以在 docker 中编译。
如果我重新启动服务微提示它:
micro_1 | 2020-07-02 03:25:36 file=auth/wrapper.go:84 level=error service=web none available
micro_1 | 172.21.0.1 - - [02/Jul/2020:03:25:36 +0000] "GET /services HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1 | 2020-07-02 03:25:39 file=auth/wrapper.go:84 level=error service=web none available
micro_1 | 172.21.0.1 - - [02/Jul/2020:03:25:39 +0000] "GET /client HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1 | 2020-07-02 03:28:34 file=auth/wrapper.go:84 level=error service=web none available
micro_1 | 172.21.0.1 - - [02/Jul/2020:03:28:34 +0000] "GET /client HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
micro_1 | 2020-07-02 03:28:38 file=auth/wrapper.go:84 level=error service=web none available
micro_1 | 172.21.0.1 - - [02/Jul/2020:03:28:37 +0000] "GET /services HTTP/1.1" 500 15 "http://localhost:8082/" "Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0"
example_1 | 2020-07-02 03:30:55 file=grpc/grpc.go:791 level=info Deregistering node: go.micro.service.example-58b408cc-eec2-41a3-8d7f-5ac1751ad795
example_1 | 2020-07-02 03:30:55 file=grpc/grpc.go:814 level=info Unsubscribing from topic: go.micro.service.example
example_1 | 2020-07-02 03:30:55 file=grpc/grpc.go:959 level=info Broker [http] Disconnected from 127.0.0.1:45863
micro_1 | 2020-07-02 03:30:55 file=registry/registry.go:102 level=error service=api unable to get go.micro.service.example service: service not found
go-micro-docker-compose-bug_example_1 exited with code 0
micro_1 | 2020-07-02 03:30:58 file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = \"transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused\"","status":"Internal Server Error"})
micro_1 | 2020-07-02 03:31:08 file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = \"transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused\"","status":"Internal Server Error"})
micro_1 | 2020-07-02 03:31:18 file=handler/handler.go:227 level=error service=debug Error calling go.micro.service.example@172.21.0.2:38625 ({"id":"go.micro.client","code":500,"detail":"connection error: desc = \"transport: Error while dialing dial tcp 172.21.0.2:38625: connect: connection refused\"","status":"Internal Server Error"})
我真的不明白,为什么它会报告没有找到任何服务或客户端,但仍然能够连接到我的服务?
最佳答案
似乎尽管 micro 的仪表板没有显示任何内容,但如果我发出 micro list services
我的示例服务已列出
然后我从 docker-compose.yml 中删除网络,停止 docker-compose 并重新启动,再次发布 micro list services
并且我的示例服务包含在 list 中。所以,这似乎是仪表板本身的错误。
关于docker-compose - 在 docker-compose 中运行时,Go micro dashboard 不注册我的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62629980/
相关文章:
microsoft-graph-api - 在新的限制下使用 Microsoft Graph API
angular - 根据 Angular 中的路由刷新组件数据
swift - 达到最大时间戳计数,不会记录更多事件 Xcode
r - 控制 geom_line() 图表中的日期(x 轴)间隔
python - 如何从不同的文件调用方法而不在python中导入它
python - 如何在 Tkinter 窗口上使用 for 循环创建多个框架?
php - 如何在 Ubuntu 16.04 中安装 php-curl
node.js - stripe.customers.retrieve 导致问题,因为它现在正在返回