GRPC直接调用测试通过
This commit is contained in:
parent
8f305a2c85
commit
16ab9eb14d
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
consulAddr string = "192.168.8.254:8500"
|
||||
consulAddr string = "127.0.0.1:8500"
|
||||
)
|
||||
|
||||
//Register 注册服务到consul
|
||||
|
|
|
|||
Loading…
Reference in New Issue