SPRINGBCLOUD5----High Availability

Source: Internet
Author: User

 PackageCom.itmuch.cloud;Importorg.springframework.boot.SpringApplication;Importorg.springframework.boot.autoconfigure.SpringBootApplication;Importorg.springframework.cloud.netflix.eureka.server.enableeurekaserver;@ Springbootapplication@enableeurekaserver Public classeurekahaapplication { Public Static voidMain (string[] args) {Springapplication.run (eurekahaapplication.class, args); }}
Spring:application:name:EUREKA-HA---Server:port:8764Spring:profiles:peer1eureka:instance:hostname:peer1 #主机名是peer1 Client:serviceUrl:defaultZone:ht TP://peer2:8762/eureka/,Http://peer3: 8763/eureka/#把自己注册到2和3, Mutual registration---Server:port:8762Spring:profiles:peer2eureka:instance:hostname:peer2 #主机名是peer2 Client:serviceUrl:defaultZone:ht TP://peer1:8761/eureka/,Http://peer3: 8763/eureka/#把自己注册到1和3, Mutual registration---Server:port:8763Spring:profiles:peer3eureka:instance:hostname:peer3 #主机名是peer3 Client:serviceUrl:defaultZone:ht TP://peer1:8761/eureka/,Http://peer2: 8762/eureka/#把自己注册到1和2, Mutual registration
<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> <parent> <groupId>com.itmuch.cloud</groupId> <artifactid>mi Croservice-spring-cloud</artifactid> <version>0.0.1-SNAPSHOT</version> </parent> < Artifactid>microservice-discovery-eureka-ha</artifactid> <packaging>jar</packaging> < Properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties&gt    ;            <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka-server</artifactId> </dependency> <!--< Dependency> <groupId>org.springframework.boot</groupId> <artifactid>spring-boot -starter-security</artifactid> </dependency> </dependencies></project>

Separate peer launches :

register multiple Eureka server addresses when a user micro-service is registered .

SPRINGBCLOUD5----High Availability

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.