GRPC直接调用测试通过

This commit is contained in:
suguo.yao 2021-01-23 20:35:44 +08:00
parent 8f305a2c85
commit 16ab9eb14d
2 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,8 @@ import (
func main() {
consul.FindServer()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
conn, err := grpc.DialContext(ctx, "consul://192.168.8.254:8500/demo", grpc.WithBlock(), grpc.WithInsecure(), grpc.WithBalancerName("round_robin"))
conn, err := grpc.Dial("127.0.0.1:9001", grpc.WithBlock(), grpc.WithInsecure())
// conn, err := grpc.DialContext(ctx, "consul://127.0.0.1:8500/demo", grpc.WithBlock(), grpc.WithInsecure(), grpc.WithBalancerName("round_robin"))
if err != nil {
cancel()
}

View File

@ -8,7 +8,7 @@ import (
)
const (
consulAddr string = "192.168.8.254:8500"
consulAddr string = "127.0.0.1:8500"
)
//Register 注册服务到consul