关于 Go-Micro 框架的使用问题

NicksGhost · · 401 次点击 · 开始浏览    置顶
最近在学习 Go-Micro 框架,参考的是 <https://studygolang.com/articles/23208?fr=sidebar> 这篇文章。 在测试服务编写完成后,开启 Micro 服务输出内容如下: ```shell >micro server 2020-08-04 16:58:39 file=server/server.go:126 level=info service=micro Loading core services 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.config 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.auth 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.network 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.runtime 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.registry 2020-08-04 16:58:39 file=v2@v2.9.1/service.go:200 level=info Starting [service] go.micro.config 2020-08-04 16:58:39 file=grpc/grpc.go:864 level=info Server [grpc] Listening on [::]:50852 2020-08-04 16:58:39 file=grpc/grpc.go:881 level=info Broker [http] Connected to 127.0.0.1:50853 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.broker 2020-08-04 16:58:39 file=v2@v2.9.1/service.go:200 level=info service=auth Starting [service] go.micro.auth 2020-08-04 16:58:39 file=grpc/grpc.go:864 level=info service=auth Server [grpc] Listening on [::]:8010 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.store 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.router 2020-08-04 16:58:39 file=v2@v2.9.1/service.go:200 level=info service=runtime Starting [service] go.micro.runtime 2020-08-04 16:58:39 file=grpc/grpc.go:864 level=info service=runtime Server [grpc] Listening on [::]:8088 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.debug 2020-08-04 16:58:39 file=grpc/grpc.go:697 level=info Registry [mdns] Registering node: go.micro.config-df207177-c96a-4bc0-a978-aa6969d6a1c7 2020-08-04 16:58:39 file=v2@v2.9.1/service.go:200 level=info service=registry Starting [service] go.micro.registry 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.proxy 2020-08-04 16:58:39 file=grpc/grpc.go:864 level=info service=registry Server [grpc] Listening on [::]:8000 2020-08-04 16:58:39 file=grpc/grpc.go:697 level=info service=auth Registry [mdns] Registering node: go.micro.auth-0fb40535-4220-488e-b8d4-beae6da461ae 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.api 2020-08-04 16:58:39 file=v2@v2.9.1/service.go:200 level=info service=broker Starting [service] go.micro.broker 2020-08-04 16:58:39 file=grpc/grpc.go:864 level=info service=broker Server [grpc] Listening on [::]:8001 2020-08-04 16:58:39 file=server/server.go:151 level=info service=micro Registering micro.web 2020-08-04 16:58:39 file=store/store.go:62 level=info service=store Initialising the [file] store with opts: {Nodes:[] Database:micro Table:store Context:<nil> Client:grpc} 2020-08-04 16:58:40 file=v2@v2.9.1/service.go:200 level=info service=store Starting [service] go.micro.store 2020-08-04 16:58:40 file=grpc/grpc.go:697 level=info service=runtime Registry [mdns] Registering node: go.micro.runtime-393d5948-67a7-4c27-83ce-cf5ae4a74d44 2020-08-04 16:58:40 file=grpc/grpc.go:864 level=info service=store Server [grpc] Listening on [::]:50867 2020-08-04 16:58:40 file=server/server.go:151 level=info service=micro Registering micro.bot 2020-08-04 16:58:39 file=router/router.go:235 level=info service=router starting micro router 2020-08-04 16:58:40 file=server/server.go:151 level=info service=micro Registering micro.init 2020-08-04 16:58:40 file=grpc/grpc.go:697 level=info service=registry Registry [mdns] Registering node: go.micro.registry-f63655c5-771d-4637-bfbf-f37289ceab7a 2020-08-04 16:58:40 file=server/server.go:186 level=info service=micro Starting service runtime 2020-08-04 16:58:40 file=server/server.go:194 level=info service=micro Service runtime started 2020-08-04 16:58:40 file=v2@v2.9.1/service.go:200 level=info service=micro Starting [service] go.micro.server 2020-08-04 16:58:40 file=grpc/grpc.go:864 level=info service=micro Server [grpc] Listening on [::]:10001 2020-08-04 16:58:40 file=grpc/grpc.go:697 level=info service=broker Registry [mdns] Registering node: go.micro.broker-572f999f-ea1b-4741-9e57-56847fad4004 2020-08-04 16:58:40 file=server/rpc_server.go:820 level=info service=server Transport [tunnel] Listening on 1950719358323824114 2020-08-04 16:58:40 file=server/rpc_server.go:840 level=info service=server Broker [tunnel] Connected to [::]:8085 {"id":"go.micro.client","code":500,"detail":"service go.micro.auth: not found","status":"Internal Server Error"} 2020-08-04 16:58:40 file=runtime/service.go:217 level=error service=micro Service micro.proxy terminated with error exit status 1 2020-08-04 16:58:40 file=grpc/grpc.go:697 level=info service=store Registry [mdns] Registering node: go.micro.store-2222c0f7-f6f7-4853-b6db-395e90e6e2fa 2020-08-04 16:58:40 file=grpc/grpc.go:730 level=info Subscribing to topic: go.micro.config.events 2020-08-04 16:58:41 file=router/router.go:242 level=info service=router starting to advertise 2020-08-04 16:58:41 file=v2@v2.9.1/service.go:200 level=info service=router Starting [service] go.micro.router 2020-08-04 16:58:41 file=grpc/grpc.go:864 level=info service=router Server [grpc] Listening on [::]:8084 2020-08-04 16:58:41 file=grpc/grpc.go:881 level=info service=router Broker [http] Connected to 127.0.0.1:50872 2020-08-04 16:58:40 file=bot/bot.go:219 level=info service=bot starting {"id":"go.micro.client","code":500,"detail":"service go.micro.auth: not found","status":"Internal Server Error"} 2020-08-04 16:58:41 file=v2@v2.9.1/service.go:200 level=info service=bot Starting [service] go.micro.bot 2020-08-04 16:58:41 file=runtime/service.go:217 level=error service=micro Service micro.api terminated with error exit status 1 2020-08-04 16:58:40 file=v2@v2.9.1/service.go:200 level=info service=debug Starting [service] go.micro.debug 2020-08-04 16:58:41 file=grpc/grpc.go:864 level=info service=debug Server [grpc] Listening on [::]:8089 2020-08-04 16:58:41 file=grpc/grpc.go:864 level=info service=bot Server [grpc] Listening on [::]:50877 2020-08-04 16:58:41 file=grpc/grpc.go:697 level=info service=micro Registry [mdns] Registering node: go.micro.server-28628675-6363-46f2-8580-8c51b9179748 {"id":"go.micro.client","code":500,"detail":"service go.micro.auth: not found","status":"Internal Server Error"} 2020-08-04 16:58:40 file=platform/platform.go:137 level=info service=init Starting service runtime 2020-08-04 16:58:41 file=platform/platform.go:144 level=info service=init Service runtime started 2020-08-04 16:58:41 file=runtime/service.go:217 level=error service=micro Service micro.web terminated with error exit status 1 2020-08-04 16:58:41 file=server/rpc_server.go:654 level=info service=server Registry [mdns] Registering node: go.micro-70af6cd1-2419-45a0-a3a3-a0356a709e72 2020-08-04 16:58:41 file=grpc/grpc.go:697 level=info service=router Registry [mdns] Registering node: go.micro.router-7d4ffc8c-2037-4e3d-898c-ce2176b2f94e 2020-08-04 16:58:41 file=router/router.go:268 level=error service=router error running the router: error publishing advert: service not found 2020-08-04 16:58:41 file=router/router.go:271 level=info service=router attempting to stop the router 2020-08-04 16:58:41 file=router/router.go:279 level=info service=router successfully stopped 2020-08-04 16:58:41 file=grpc/grpc.go:697 level=info service=debug Registry [mdns] Registering node: go.micro.debug-106d26e6-1034-407d-9254-87f1fdce1475 2020-08-04 16:58:41 file=grpc/grpc.go:697 level=info service=bot Registry [mdns] Registering node: go.micro.bot-5ff06c1d-5e22-45f8-bc1e-421408429a3e 2020-08-04 16:58:42 file=network/network.go:209 level=info service=server Network [go.micro] listening on :8085 2020-08-04 16:58:42 file=v2@v2.9.1/service.go:200 level=info service=server Starting [service] go.micro.network 2020-08-04 16:58:42 file=grpc/grpc.go:864 level=info service=server Server [grpc] Listening on [::]:50878 2020-08-04 16:58:42 file=grpc/grpc.go:697 level=info service=server Registry [mdns] Registering node: go.micro.network-70af6cd1-2419-45a0-a3a3-a0356a709e72 ``` 可以看到授权似乎出现了问题,但其它日志输出正常 ```shell 2020-08-04 16:58:40 file=server/rpc_server.go:840 level=info service=server Broker [tunnel] Connected to [::]:8085 {"id":"go.micro.client","code":500,"detail":"service go.micro.auth: not found","status":"Internal Server Error"} 2020-08-04 16:58:40 file=bot/bot.go:219 level=info service=bot starting {"id":"go.micro.client","code":500,"detail":"service go.micro.auth: not found","status":"Internal Server Error"} 2020-08-04 16:58:41 file=grpc/grpc.go:697 level=info service=micro Registry [mdns] Registering node: go.micro.server-28628675-6363-46f2-8580-8c51b9179748 {"id":"go.micro.client","code":500,"detail":"service go.micro.auth: not found","status":"Internal Server Error"} ``` 接着我使用了试着输出服务列表,输出以下错误: ```shell >micro list services {"id":"go.micro.client","code":500,"detail":"connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:8081: connectex: No connection could be made because the target machine actively refused it.\"","status":"Inte rnal Server Error"} ``` 按照它说的我去防火墙添加了**8081**端口的出入站规则,但还是输出同样的错误,所以想请教下各位这个问题需要如何解决?

有疑问加站长微信联系

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:812540095

401 次点击  
加入收藏 微博
2 回复  |  直到 2020-08-06 15:06:32
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传