浏览代码

使用ip地址注册

chao 4 年之前
父节点
当前提交
6d9a12ef42
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/main/resources/application.yml

+ 5 - 2
src/main/resources/application.yml

@@ -8,6 +8,9 @@ spring:
 
 # 指定服务注册中心的地址
 eureka:
+  instance:
+    prefer-ip-address: true       # 是否使用 ip 地址注册
+    instance-id: ${spring.cloud.client.ip-address}:${server.port} # ip:port
   client:
-    serviceUrl:
-      defaultZone: http://localhost:18000/eureka
+    service-url:                  # 设置服务注册中心地址
+      defaultZone: http://localhost:18000/eureka/