This commit is contained in:
parent
083140fef8
commit
4c56d907ed
5
main.go
5
main.go
@ -22,7 +22,7 @@ func initNacos() {
|
|||||||
}
|
}
|
||||||
cc := constant.ClientConfig{
|
cc := constant.ClientConfig{
|
||||||
AppName: "api1",
|
AppName: "api1",
|
||||||
NamespaceId: "", //namespace id
|
NamespaceId: "public", //namespace id
|
||||||
TimeoutMs: 5000,
|
TimeoutMs: 5000,
|
||||||
NotLoadCacheAtStart: true,
|
NotLoadCacheAtStart: true,
|
||||||
RotateTime: "1h",
|
RotateTime: "1h",
|
||||||
@ -43,11 +43,12 @@ func initNacos() {
|
|||||||
portNum, _ := strconv.Atoi(port)
|
portNum, _ := strconv.Atoi(port)
|
||||||
pp := uint64(portNum)
|
pp := uint64(portNum)
|
||||||
success, err := client.RegisterInstance(vo.RegisterInstanceParam{
|
success, err := client.RegisterInstance(vo.RegisterInstanceParam{
|
||||||
//Ip: "172.30.0.90",
|
Ip: "api-demo",
|
||||||
Port: pp,
|
Port: pp,
|
||||||
Weight: 10,
|
Weight: 10,
|
||||||
Enable: true,
|
Enable: true,
|
||||||
ServiceName: "api1",
|
ServiceName: "api1",
|
||||||
|
Ephemeral: true,
|
||||||
})
|
})
|
||||||
log.Println("Nacos注册结果: ", success)
|
log.Println("Nacos注册结果: ", success)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user