From 02b26ee9a4c1632a73a01c6c472a306be997c095 Mon Sep 17 00:00:00 2001 From: kklt1996 <18332763730@163.com> Date: Tue, 18 Jul 2017 19:23:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=AE=8C=E6=88=90=E4=B8=A4=E4=B8=AA=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=B8=AD=E5=BF=83=E7=9A=84=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + README.md | 4 + .../server/ConfigServerApplication.java | 1 + .../src/main/resources/application.yml | 5 +- .../src/main/resources/application.yml | 27 ++++++ .../src/main/resources/bootstrap.yml | 2 +- eureka-server2/.gitignore | 31 +++++++ eureka-server2/pom.xml | 82 +++++++++++++++++++ .../server2/EurekaServer2Application.java | 14 ++++ .../src/main/resources/application.yml | 27 ++++++ .../src/main/resources/bootstrap.yml | 7 ++ .../EurekaServer2ApplicationTests.java | 16 ++++ pom.xml | 1 + upms/src/main/resources/application.yml | 28 +++++++ upms/src/main/resources/bootstrap.yml | 2 +- 15 files changed, 245 insertions(+), 3 deletions(-) create mode 100644 eureka-server/src/main/resources/application.yml create mode 100644 eureka-server2/.gitignore create mode 100644 eureka-server2/pom.xml create mode 100644 eureka-server2/src/main/java/com/micro/fast/eureka/server2/EurekaServer2Application.java create mode 100644 eureka-server2/src/main/resources/application.yml create mode 100644 eureka-server2/src/main/resources/bootstrap.yml create mode 100644 eureka-server2/src/test/java/com/micro/fast/eureka/server2/EurekaServer2ApplicationTests.java create mode 100644 upms/src/main/resources/application.yml diff --git a/.gitignore b/.gitignore index 8c1680a..7a8343d 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ out .mvn mvnw mvnw.cmd +classes diff --git a/README.md b/README.md index 5b90028..cc8b139 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ ###配置中心 端口号 10001 +www.config.server.com ###注册中心 端口号 10002 +www.eureka.server.com ###注册中心2 端口号 10003 +www.eureka.server2.com ###用户权限管理中心 端口号 10004 +www.upms.com diff --git a/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java b/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java index d75c1dc..16c1b7f 100644 --- a/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java +++ b/config-server/src/main/java/com/micro/fast/config/server/ConfigServerApplication.java @@ -2,6 +2,7 @@ package com.micro.fast.config.server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.config.server.EnableConfigServer; @SpringBootApplication diff --git a/config-server/src/main/resources/application.yml b/config-server/src/main/resources/application.yml index 3c26aae..869a542 100644 --- a/config-server/src/main/resources/application.yml +++ b/config-server/src/main/resources/application.yml @@ -1,3 +1,4 @@ +# 程序实例的配置,git仓库的配置 spring: application: name: config-server @@ -15,8 +16,10 @@ management: enabled: false redis: enabled: false + diskspace: + enabled: true port: 20001 - # info 信息的获取 +# info 信息的获取 info: app: profiles: dev diff --git a/eureka-server/src/main/resources/application.yml b/eureka-server/src/main/resources/application.yml new file mode 100644 index 0000000..a753a03 --- /dev/null +++ b/eureka-server/src/main/resources/application.yml @@ -0,0 +1,27 @@ +# 只是用来在本地编写文件用,无任何使用 +info: + app: + profiles: dev + name: eureka-server #从pom.xml中获取 + description: eureka-server +spring: + application: + name: eureka-server # 实例的名称 +server: + port: 10002 +eureka: + client: + service-url: + defaultZone: http://www.eureka.server2.com:10003/eureka # 和其他注册中心连接 + instance: + hostname: www.eureka.server.com # 实例的主机名 +# 健康检查的配置 +management: + health: + mail: + enabled: false + redis: + enabled: false + security: + enabled: false #springbooot1.5.*以后如果要使用refresh功能的要设置false + port: 20002 \ No newline at end of file diff --git a/eureka-server/src/main/resources/bootstrap.yml b/eureka-server/src/main/resources/bootstrap.yml index 63e8596..e2b39e3 100644 --- a/eureka-server/src/main/resources/bootstrap.yml +++ b/eureka-server/src/main/resources/bootstrap.yml @@ -2,7 +2,7 @@ spring: cloud: config: - uri: http://localhost:10001/ + uri: http://www.config.server.com:10001/ profile: dev label: master name: eureka-server diff --git a/eureka-server2/.gitignore b/eureka-server2/.gitignore new file mode 100644 index 0000000..8c1680a --- /dev/null +++ b/eureka-server2/.gitignore @@ -0,0 +1,31 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +### maven ### +target +out +.mvn +mvnw +mvnw.cmd diff --git a/eureka-server2/pom.xml b/eureka-server2/pom.xml new file mode 100644 index 0000000..d46799e --- /dev/null +++ b/eureka-server2/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + com.micro.fast.eureka.server2 + eureka-server2 + 0.0.1-SNAPSHOT + jar + + eureka-server2 + eureka-server2 + + + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + Dalston.SR1 + 1.8 + 1.8 + 1.8 + + + + + + org.springframework.cloud + spring-cloud-starter-config + + + + org.springframework.cloud + spring-cloud-starter-eureka-server + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/eureka-server2/src/main/java/com/micro/fast/eureka/server2/EurekaServer2Application.java b/eureka-server2/src/main/java/com/micro/fast/eureka/server2/EurekaServer2Application.java new file mode 100644 index 0000000..baa2971 --- /dev/null +++ b/eureka-server2/src/main/java/com/micro/fast/eureka/server2/EurekaServer2Application.java @@ -0,0 +1,14 @@ +package com.micro.fast.eureka.server2; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@SpringBootApplication +@EnableEurekaServer //开启注册中心的相关服务 +public class EurekaServer2Application { + + public static void main(String[] args) { + SpringApplication.run(EurekaServer2Application.class, args); + } +} diff --git a/eureka-server2/src/main/resources/application.yml b/eureka-server2/src/main/resources/application.yml new file mode 100644 index 0000000..6ae4eab --- /dev/null +++ b/eureka-server2/src/main/resources/application.yml @@ -0,0 +1,27 @@ +# 只是用来在本地编写文件用,无任何使用 +info: + app: + profiles: dev + name: eureka-server2 #从pom.xml中获取 + description: eureka-server2 +spring: + application: + name: eureka-server2 # 实例的名称 +server: + port: 10003 +eureka: + client: + service-url: + defaultZone: http://www.eureka.server.com:10002/eureka # 和其他注册中心连接 + instance: + hostname: www.eureka.server2.com # 实例的主机名 +# 健康检查的配置 +management: + health: + mail: + enabled: false + redis: + enabled: false + security: + enabled: false #springbooot1.5.*以后如果要使用refresh功能的要设置false + port: 20003 \ No newline at end of file diff --git a/eureka-server2/src/main/resources/bootstrap.yml b/eureka-server2/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..2d53a86 --- /dev/null +++ b/eureka-server2/src/main/resources/bootstrap.yml @@ -0,0 +1,7 @@ +spring: + cloud: + config: + name: eureka-server2 + profile: dev + label: master + uri: http://www.config.server.com:10001/ diff --git a/eureka-server2/src/test/java/com/micro/fast/eureka/server2/EurekaServer2ApplicationTests.java b/eureka-server2/src/test/java/com/micro/fast/eureka/server2/EurekaServer2ApplicationTests.java new file mode 100644 index 0000000..0a7e70a --- /dev/null +++ b/eureka-server2/src/test/java/com/micro/fast/eureka/server2/EurekaServer2ApplicationTests.java @@ -0,0 +1,16 @@ +package com.micro.fast.eureka.server2; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class EurekaServer2ApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/pom.xml b/pom.xml index 8423b93..ac47605 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ config-server eureka-server + eureka-server2 upms diff --git a/upms/src/main/resources/application.yml b/upms/src/main/resources/application.yml new file mode 100644 index 0000000..56dacbf --- /dev/null +++ b/upms/src/main/resources/application.yml @@ -0,0 +1,28 @@ +# 只是用来在本地编写文件用,无任何使用 +info: + app: + profiles: dev + name: upms + description: upms +spring: + application: + name: upms +server: + port: 10004 +eureka: + client: + serviceUrl: + defaultZone: http://www.eureka.server.com:10002/eureka/ #指定服务注册中心的位置 +feign: + hystrix: + enabled: true #开启监控熔断 +# 健康检查的相关配置 +management: + health: + mail: + enabled: false + redis: + enabled: false + security: + enabled: false #springbooot1.5.*以后如果要使用refresh功能的要设置false + port: 20004 diff --git a/upms/src/main/resources/bootstrap.yml b/upms/src/main/resources/bootstrap.yml index 7570045..3db1f1f 100644 --- a/upms/src/main/resources/bootstrap.yml +++ b/upms/src/main/resources/bootstrap.yml @@ -2,7 +2,7 @@ spring: cloud: config: - uri: http://localhost:10001/ + uri: http://www.config.server.com:10001/ profile: dev label: master name: upms \ No newline at end of file