diff --git a/main.go b/main.go index d83f0ee..a9a621f 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ func initNacos() { } cc := constant.ClientConfig{ AppName: "api1", - NamespaceId: "", //namespace id + NamespaceId: "public", //namespace id TimeoutMs: 5000, NotLoadCacheAtStart: true, RotateTime: "1h", @@ -43,11 +43,12 @@ func initNacos() { portNum, _ := strconv.Atoi(port) pp := uint64(portNum) success, err := client.RegisterInstance(vo.RegisterInstanceParam{ - //Ip: "172.30.0.90", + Ip: "api-demo", Port: pp, Weight: 10, Enable: true, ServiceName: "api1", + Ephemeral: true, }) log.Println("Nacos注册结果: ", success) if err != nil {