修改配置文件,完成两个注册中心的注册
This commit is contained in:
@@ -29,3 +29,4 @@ out
|
||||
.mvn
|
||||
mvnw
|
||||
mvnw.cmd
|
||||
classes
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
###配置中心 端口号 10001
|
||||
www.config.server.com
|
||||
###注册中心 端口号 10002
|
||||
www.eureka.server.com
|
||||
###注册中心2 端口号 10003
|
||||
www.eureka.server2.com
|
||||
###用户权限管理中心 端口号 10004
|
||||
www.upms.com
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.micro.fast.eureka.server2</groupId>
|
||||
<artifactId>eureka-server2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>eureka-server2</name>
|
||||
<description>eureka-server2</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.4.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--配置客户端的依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency>
|
||||
<!--注册中心的依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka-server</artifactId>
|
||||
</dependency>
|
||||
<!--web相关依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--监控相关依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--测试相关依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
+14
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,7 @@
|
||||
spring:
|
||||
cloud:
|
||||
config:
|
||||
name: eureka-server2
|
||||
profile: dev
|
||||
label: master
|
||||
uri: http://www.config.server.com:10001/
|
||||
+16
@@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
<modules>
|
||||
<module>config-server</module>
|
||||
<module>eureka-server</module>
|
||||
<module>eureka-server2</module>
|
||||
<module>upms</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
@@ -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
|
||||
@@ -2,7 +2,7 @@
|
||||
spring:
|
||||
cloud:
|
||||
config:
|
||||
uri: http://localhost:10001/
|
||||
uri: http://www.config.server.com:10001/
|
||||
profile: dev
|
||||
label: master
|
||||
name: upms
|
||||
Reference in New Issue
Block a user