Spring Cloud Eureka Service governance (highly available service center)

Source: Internet
Author: User

In the microservices architecture, we consider the failure situation, so in a production environment we need to deploy the various components of the service in a highly available deployment.

The high availability of Eureka Server is actually to register itself as a service to other service registries, thus forming a set of mutually registered service centers,

To achieve a high-availability effect by synchronizing the service list with each other.

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=1111eureka.instance.hostname=  Peer1eureka.client.serviceUrl.defaultZone=http://peer2:1112/eureka/

2. Create the Application-pee2.properties, as a Peer2 service center configuration, than Serviceurl point to Peer1

spring.application.name=eureka-serverserver.port=1112eureka.instance.hostname=  Peer2eureka.client.serviceUrl.defaultZone=http://peer1:1111/eureka/

3. Add the configuration to the local host file so that the serviceurl configured in the host form can be properly accessed locally

127.0.0.1 peer1  127.0.0.1 peer2

4. Use the Spring.profiles.active property to start Peer1 separately, Peer2

Java-jar Eureka-server-0.0.1.jar--spring.profiles.active=-jar Eureka-server-0.0.1.jar-- Spring.profiles.active=peer2

5. Start complete

6. Visit http://peer1:1111/as follows:

7. Visit http://peer2:1112/as follows:

8. If we stop a service, we will find that the service will become this state Unavailable-replicas state

Spring Cloud Eureka Service governance (highly available service 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.