服务启动:
```./service --registry=etcd --registry_address=http://ip:2379```
此处ip是其他服务器,可以ping通
```shell
Starting [service] go.micro.srv.user
2020-03-16 17:51:38 Server [grpc] Listening on [::]:36693
2020-03-16 17:51:38 Registry [etcd] Registering node: go.micro.srv.user-84597f93-d2b4-4032-ab33-946ab2782c6e
{"level":"warn","ts":"2020-03-16T17:51:43.175+0800","caller":"clientv3/retry_interceptor.go:61","msg":"retrying of unary invoker failed","target":"endpoint://client-a42972f7-2140-4f82-8cc0-ac00e29d34d0/127.0.0.1:2379","attempt":0,"error":"rpc error: code = DeadlineExceeded desc = latest connection error: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused\""}
2020-03-16 17:51:43 Server register error: %!(EXTRA context.deadlineExceededError=context deadline exceeded)
```
还是注册到本地,而没有注册到远程etcd,不知道哪里出错。
有疑问加站长微信联系(非本文作者)
![](https://static.golangjob.cn/static/img/footer.png?imageView2/2/w/280)