From ceed3d285e545111c44469120cc651d232a38252 Mon Sep 17 00:00:00 2001 From: lsy <18332763730@163.com> Date: Mon, 20 Nov 2017 18:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8ip?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=EF=BC=8C=E5=AE=9A=E4=B9=89register.server.ip?= =?UTF-8?q?,config.server.ip=E4=BE=BF=E4=BA=8E=E6=94=AF=E6=8C=81=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E8=BF=90=E8=A1=8C=E4=BB=A5=E5=8F=8A=E4=BD=BF=E7=94=A8?= =?UTF-8?q?docker=E6=96=B9=E5=BC=8F=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ms/cms/src/main/resources/bootstrap.yml | 8 ++++++-- ms/config-server/src/main/resources/bootstrap.yml | 6 ++++-- ms/gateway/src/main/resources/bootstrap.yml | 8 ++++++-- .../src/main/resources/bootstrap.yml | 13 ++++++++++--- .../src/main/resources/bootstrap.yml | 13 ++++++++++--- ms/ucenter/src/main/resources/bootstrap.yml | 8 ++++++-- ms/upms/src/main/resources/bootstrap.yml | 8 ++++++-- 7 files changed, 48 insertions(+), 16 deletions(-) diff --git a/ms/cms/src/main/resources/bootstrap.yml b/ms/cms/src/main/resources/bootstrap.yml index 3a15ccf..99d2c60 100644 --- a/ms/cms/src/main/resources/bootstrap.yml +++ b/ms/cms/src/main/resources/bootstrap.yml @@ -1,3 +1,7 @@ +#自定义参数,用于命令行替换,默认值是127.0.0.1 +register: + server: + ip: 127.0.0.1 # 从配置中心加载文件 spring: cloud: @@ -13,6 +17,6 @@ spring: eureka: client: serviceUrl: - defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + defaultZone: http://micro:fast@${register.server.ip}:10002/eureka/,http://micro:fast@${register.server.ip}:10003/eureka/ #配置所有的注册中心 instance: - hostname: www.cms.com \ No newline at end of file + prefer-ip-address: true \ No newline at end of file diff --git a/ms/config-server/src/main/resources/bootstrap.yml b/ms/config-server/src/main/resources/bootstrap.yml index aea05c6..2ad114e 100644 --- a/ms/config-server/src/main/resources/bootstrap.yml +++ b/ms/config-server/src/main/resources/bootstrap.yml @@ -1,3 +1,5 @@ +#自定义参数,用于命令行替换,默认值是127.0.0.1 +register.ip: 127.0.0.1 # 程序实例的配置,git仓库的配置 spring: application: @@ -12,6 +14,6 @@ spring: eureka: client: service-url: - defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + defaultZone: http://micro:fast@${register.ip}:10002/eureka/,http://micro:fast@${register.ip}:10003/eureka/ #配置所有的注册中心 instance: - hostname: www.config.server.com \ No newline at end of file + prefer-ip-address: true \ No newline at end of file diff --git a/ms/gateway/src/main/resources/bootstrap.yml b/ms/gateway/src/main/resources/bootstrap.yml index 1410c9e..ecdbb5c 100644 --- a/ms/gateway/src/main/resources/bootstrap.yml +++ b/ms/gateway/src/main/resources/bootstrap.yml @@ -1,3 +1,7 @@ +#自定义参数,用于命令行替换,默认值是127.0.0.1 +register: + server: + ip: 127.0.0.1 # 从配置中心加载文件 spring: cloud: @@ -13,6 +17,6 @@ spring: eureka: client: serviceUrl: - defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + defaultZone: http://micro:fast@${register.server.ip}:10002/eureka/,http://micro:fast@${register.server.ip}:10003/eureka/ #配置所有的注册中心 instance: - hostname: www.gateway.com + prefer-ip-address: true diff --git a/ms/register-center1/src/main/resources/bootstrap.yml b/ms/register-center1/src/main/resources/bootstrap.yml index f185ba6..f5dbdad 100644 --- a/ms/register-center1/src/main/resources/bootstrap.yml +++ b/ms/register-center1/src/main/resources/bootstrap.yml @@ -1,14 +1,21 @@ +#自定义参数,用于命令行替换,默认值是127.0.0.1 +register: + server: + ip: 127.0.0.1 +config: + server: + ip: 127.0.0.1 #从配置中心加载配置文件,启动eureka-server服务 spring: cloud: config: - uri: http://config:server@127.0.0.1:9999/ + uri: http://config:server@${config.server.ip}:9999/ profile: dev label: master name: eureka-server eureka: client: service-url: - defaultZone: http://micro:fast@127.0.0.1:10003/eureka #和其他注册中心连接 + defaultZone: http://micro:fast@${register.server.ip}:10003/eureka #和其他注册中心连接 instance: - hostname: www.eureka.server.com # 实例的主机名 \ No newline at end of file + prefer-ip-address: true \ No newline at end of file diff --git a/ms/register-center2/src/main/resources/bootstrap.yml b/ms/register-center2/src/main/resources/bootstrap.yml index cf1452f..fea02ca 100644 --- a/ms/register-center2/src/main/resources/bootstrap.yml +++ b/ms/register-center2/src/main/resources/bootstrap.yml @@ -1,13 +1,20 @@ +#自定义参数,用于命令行替换,默认值是127.0.0.1 +register: + server: + ip: 127.0.0.1 +config: + server: + ip: 127.0.0.1 spring: cloud: config: name: eureka-server2 profile: dev label: master - uri: http://config:server@127.0.0.1:9999/ + uri: http://config:server@${config.server.ip}:9999/ eureka: client: service-url: - defaultZone: http://micro:fast@127.0.0.1:10002/eureka #和其他注册中心连接 + defaultZone: http://micro:fast@${register.server.ip}:10002/eureka #和其他注册中心连接 instance: - hostname: www.eureka.server2.com # 实例的主机名 \ No newline at end of file + prefer-ip-address: true \ No newline at end of file diff --git a/ms/ucenter/src/main/resources/bootstrap.yml b/ms/ucenter/src/main/resources/bootstrap.yml index 2ff0f4d..52b5916 100644 --- a/ms/ucenter/src/main/resources/bootstrap.yml +++ b/ms/ucenter/src/main/resources/bootstrap.yml @@ -1,3 +1,7 @@ +#自定义参数,用于命令行替换,默认值是127.0.0.1 +register: + server: + ip: 127.0.0.1 # 从配置中心加载文件 spring: cloud: @@ -13,6 +17,6 @@ spring: eureka: client: serviceUrl: - defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + defaultZone: http://micro:fast@${register.server.ip}:10002/eureka/,http://micro:fast@${register.server.ip}:10003/eureka/ #配置所有的注册中心 instance: - hostname: www.ucenter.com \ No newline at end of file + prefer-ip-address: true \ No newline at end of file diff --git a/ms/upms/src/main/resources/bootstrap.yml b/ms/upms/src/main/resources/bootstrap.yml index cd427d0..a9089ee 100644 --- a/ms/upms/src/main/resources/bootstrap.yml +++ b/ms/upms/src/main/resources/bootstrap.yml @@ -1,3 +1,7 @@ +#自定义参数,用于命令行替换,默认值是127.0.0.1 +register: + server: + ip: 127.0.0.1 # 从配置中心加载文件 spring: cloud: @@ -13,6 +17,6 @@ spring: eureka: client: serviceUrl: - defaultZone: http://micro:fast@127.0.0.1:10002/eureka/,http://micro:fast@127.0.0.1:10003/eureka/ #配置所有的注册中心 + defaultZone: http://micro:fast@${register.server.ip}:10002/eureka/,http://micro:fast@${register.server.ip}:10003/eureka/ #配置所有的注册中心 instance: - hostname: www.upms.com \ No newline at end of file + prefer-ip-address: true \ No newline at end of file