1. Create a new sub-module microservicecloud-eureka-7002 (later referred to as 7002) and microservicecloud-eureka-7003 (later referred to as 7003), packaging are jar mode to microservicecloud-eureka-7001 (later referred to as 7001) of pom.xml as a template configuration.
2. Copy 7001 EurekaServer7001_App.java, application.properties files to 7002 and 7003, and to modify the boot class EurekaServer7002_App.java, EurekaServer7003_App.java
3. Because the cluster, eureka to distinguish each instance, modify the mapping configuration of the machine, using the domain name
Found C: \ Windows \ System32 \ drivers \ hosts file under the etc directory, add the following:
127.0.0.1 eureka7001.com 127.0.0.1 eureka7002.com 127.0.0.1 eureka7003.com
4. Modify the application.properties file 7001,7002,7003
7001:
server.port = 7001 instance of the server name #eureka eureka.instance.hostname = eureka7001.com #false said they did not register with the registry yourself eureka.client.register-with-Eureka = false #false said he is to end the registry, I the duty is to maintain the service instance, do not need to search services eureka.client.fetch-Registry = false # set to interact with Eureka Server address lookup services and registration services will need to rely on this address. eureka.client.service-url.defaultZone = http: //eureka7002.com: 7002 / eureka /, http: //eureka7003.com: 7003 / eureka /
7002:
server.port = 7002 instance of the server name #eureka eureka.instance.hostname = eureka7002.com #false said they did not register with the registry yourself eureka.client.register-with-Eureka = false #false said he is to end the registry, I the duty is to maintain the service instance, do not need to search services eureka.client.fetch-Registry = false # set to interact with Eureka Server address lookup services and registration services will need to rely on this address. eureka.client.service-url.defaultZone = http: //eureka7001.com: 7001 / eureka /, http: //eureka7003.com: 7003 / eureka /
7003:
server.port = 7003 instance of the server name #eureka eureka.instance.hostname = eureka7003.com #false said they did not register with the registry yourself eureka.client.register-with-Eureka = false #false said he is to end the registry, I the duty is to maintain the service instance, do not need to search services eureka.client.fetch-Registry = false # set to interact with Eureka Server address lookup services and registration services will need to rely on this address. eureka.client.service-url.defaultZone = http: //eureka7001.com: 7001 / eureka /, http: //eureka7002.com: 7002 / eureka /
5. Modify application.properties microservicecloud-provider-dept-8001 of
Because it is a cluster, you need to be registered to each client in EurekaServer.
# Client registers into service within eureka list items eureka.client.service-url.defaultZone = http: //eureka7001.com: 7001 / eureka /, http: //eureka7002.com: 7002 / eureka /, http: // eureka7003.com:7003/eureka/
6. Click Start 7001,7002,7003, microservicecloud-provider-dept-8001, respectively, visit:
http://eureka7001.com:7001/
http://eureka7002.com:7002/
http://eureka7003.com:7003/