Spring Cloud Eureka High-Availability Registration center

Source: Internet
Author: User

Reference: <<spring Cloud Micro-service combat >>

In a distributed environment such as the microservices architecture, each component needs to be highly available for deployment.

Eureka Server High Availability is actually registering itself as a service to other service registries, thus forming a set of mutually registered service registries to synchronize the service inventory to achieve a high availability effect.

Building a two-node service registry cluster

to Build a node service registry cluster:

1. Create the application-peer1.properties as a configuration for the Peer1 Service Center and Point Serviceurl to Peer2:

spring.application.name=eureka-serverserver.port=1001eureka.instance.hostname=  Peer1eureka.instance.prefer-ip-address=trueeureka.client.serviceUrl.defaultZone=http: // 192.168.1.2:1002/eureka/

2. Create the application-peer2.properties as a configuration for the Peer2 Service Center and Point Serviceurl to Peer1:

spring.application.name=eureka-Serverserver.port=1002eureka.instance.hostname=  Peer2eureka.instance.prefer-ip-address=trueeureka.client.serviceUrl.defaultZone=http: // 192.168.1.2:1001/eureka/

Start Peer1 and Peer2 by Spring.profiles.active properties, respectively

java -jar eureka-server-1.0. 0. Jar--spring.profiles.active=peer1-jar eureka-server-1.0. 0. Jar--spring.profiles.active=peer2

After starting two items, visit Peer1 's registry http://localhost:1001/

Spring Cloud Eureka High-Availability Registration center

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.