Spring Cloud Eureka clusters to deploy Linux environment

  Or three axes: first change the configuration file, clustered, then the package, upload it to linux environment (3 nodes), and finally started jar package up and running.

  1, in the original eureka server-side code (see version Greenwich.SR2 of Spring Cloud Eureka example modification) on the basis of configuration files, this time we abandoned the original application.properties file, add three yml (you can also use properties, their own selection):

  application-es1.yml (192.1.1.0 to a node, it needs to specify the two nodes as an additional registration center, the other two empathy):

eureka:
    client:
        fetch-registry: true
        register-with-eureka: true
        service-url:
            defaultZone: http://192.1.1.1:8761/eureka,http://192.1.1.2:8761/eureka

spring:
    profiles: es1
    application:
        name: eureka-server

server:
    port: 8761

  application-es2.yml:

eureka:
    client:
        fetch-registry: true
        register-with-eureka: true
        service-url:
            defaultZone: http://192.1.1.0:8761/eureka,http://192.1.1.2:8761/eureka

spring:
    profiles: es2
    application:
        name: eureka-server

server:
    port: 8761

  application-es3.yml:

eureka:
    client:
        fetch-registry: true
        register-with-eureka: true
        service-url:
            defaultZone: http://192.1.1.0:8761/eureka,http://192.1.1.1:8761/eureka

spring:
    profiles: es3
    application:
        name: eureka-server
server:
    port: 8761

  2, the packets directly to the maven three nodes corresponding rz -y linux jar packets generated upload

  3, started on three nodes eureka-server, specify the parameters es1, es2, es3 depending on the environment, for example, I started on 192.1.1.0, then I need to specify the environment es1, the other two the same way:

java -jar uiss-discovery-eureka-0.0.1-SNAPSHOT.jar --spring.profiles.active=es1

  Finally, look eureka interface http://192.1.1.0:8761/, we can see already clustered, the other two link interface is not posted:

 

 

Guess you like

Origin www.cnblogs.com/wuxun1997/p/11230848.html
Recommended