Terry-Mao / goim

goim
https://goim.io/
MIT License
7.22k stars 1.78k forks source link

mac环境m1芯片不兼容discovery, 搞了docker容器把所有环境都装在里面了 一系列问题 老哥们来看看 #392

Open ltstudy opened 2 years ago

ltstudy commented 2 years ago

2022/10/25 04:08:25 start watch filepath: ../conf/discovery.toml INFO 10/25-04:08:25.763 /usr/workspace/go/src/discovery/discovery/syncup.go:159 discovery changed nodes:[127.0.0.1:7171] zones:map[] INFO 10/25-04:08:25.764 /usr/workspace/go/src/discovery/registry/registry.go:229 Polls from(test1) new connection(1) INFO 10/25-04:08:25.769 /usr/workspace/go/pkg/mod/github.com/go-kratos/kratos@v1.0.1/pkg/net/http/blademaster/server.go:97 blademaster: start http listen addr: 127.0.0.1:7171 INFO 10/25-04:08:25.769 /usr/workspace/go/src/discovery/http/http.go:28 [HTTP] Listening on: 127.0.0.1:7171

容器里面discovery已经启动

然后分别启动comet,logic,job 运行comet

target/comet -conf=target/comet.toml -region=sh -zone=sh001 host=test1 deploy.env=dev weight=10 addrs=127.0.0.1

运行logic

target/logic -conf=target/logic.toml -region=sh -zone=sh001 host=test1 deploy.env=dev weight=10 addrs=127.0.0.1

运行job

target/job -conf=target/job.toml -region=sh -zone=sh001 deploy.env=dev weight=10 addrs=127.0.0.1

同时docker的端口全部映射到宿主机了

comet报错: false E1025 02:24:44.556011 1838 client.go:551] discovery: client.Get(http://127.0.0.1:7171/discovery/polls?appid=infra.discovery&env=dev&hostname=13cedd4558a6&latest_timestamp=1666664670575606167) error(Get "http://127.0.0.1:7171/discovery/polls?appid=infra.discovery&env=dev&hostname=13cedd4558a6&latest_timestamp=1666664670575606167": context canceled) job报错: [root@13cedd4558a6 goim-master]# target/job -conf=target/job.toml -region=sh -zone=sh001 deploy.env=dev weight=10 addrs=127.0.0.1 E1025 02:31:58.837223 1995 client.go:551] discovery: client.Get(http://127.0.0.1:7171/discovery/polls?appid=infra.discovery&env=dev&hostname=13cedd4558a6&latest_timestamp=1666664670575606167) error(Get "http://127.0.0.1:7171/discovery/polls?appid=infra.discovery&env=dev&hostname=13cedd4558a6&latest_timestamp=1666664670575606167": context canceled)

容器内去curl curl 'http://127.0.0.1:7171/discovery/fetch?zone=sh001&env=dev&appid=goim.comet&status=1' {"code":0,"message":"0","ttl":1,"data":{"instances":{"sh001":[{"region":"sh","zone":"sh001","env":"dev","appid":"goim.comet","hostname":"13cedd4558a6","addrs":["grpc://127.0.0.1:3109"],"version":"","metadata":{"addrs":"","conn_count":"0","ip_count":"0","offline":"false","weight":"0"},"status":1,"reg_timestamp":1666666040250462677,"up_timestamp":1666666050262881042,"renew_timestamp":1666666040250462677,"dirty_timestamp":1666666050262881042,"latest_timestamp":1666666050262881042}]},"latest_timestamp":1666666040250462677}} 可以拿到结果 在目录:src/discovery/naming/client.go:583 应该是在这个地方报错 if err = d.httpClient.Get(ctx, uri, "", params, res); err != nil { if ctx.Err() != context.Canceled { log.Error("discovery: client.Get(%s) error(%+v)", uri+"?"+params.Encode(), err) } return } 是因为我docker容器和宿主机的网域问题还是什么问题,求大佬帮忙看看 !!!

ltstudy commented 2 years ago

换linux了 服了 没人管

lintanghui commented 2 years ago

容器启动需要暴露实际ip而不是127.0.0.1 容器内部可以访问127地址 扩容器是没法访问127地址的。。

ltstudy commented 2 years ago

容器启动需要暴露实际ip而不是127.0.0.1 容器内部可以访问127地址 扩容器是没法访问127地址的。。

也已经在容器做了proxy,把容器内部ip暴露出去了,但是还是一样 试过把dicovery打包成镜像 对外暴露ip方案,后面又改成代理暴露ip 也是无果 在到后面我把环境打包成一个镜像在容器内访问也是无果 。。。

9cat commented 2 years ago

希望能有一个cli完成一个IM的部署的docker方案!

ltstudy commented 2 years ago

希望能有一个cli完成一个IM的部署的docker方案!

我打包好了 但是端口映射还是有问题 等我空了研究研究,我现在换成ecs了