Spring Cloud Eureka 4 (Highly available service registry)

Source: Internet
Author: User

In a distributed environment such as microservices, we need to take full account of the failure situation, so a high-availability deployment of individual components must be considered in a production environment, as is the case with service registries.

The high availability of the Eureka Server is actually about registering itself as a service to other registries, so that a set of registered registries can be implemented to achieve a high-availability effect by synchronizing the list of services with each other.

Create a new project Eureka-cluster and Eureka-cluster2

Project creation refer to the building of the Service registration center above

Http://www.cnblogs.com/HanShisi/p/8319856.html

Not here to repeat.

The difference lies in the configuration of the Application.properties file.

The configuration of the Eureka-cluster is as follows:

Spring.application.name=eureka-server
server.port=1111
Eureka.instance.hostname=peer1
Eureka.client.serviceurl.defaultzone=http://peer2:1112/eureka

The configuration of the Eureka-cluster2 is as follows:

Spring.application.name=eureka-server
server.port=1112
Eureka.instance.hostname=peer2
Eureka.client.serviceurl.defaultzone=http://peer1:1111/eureka

Note:

Add the following configuration to the C:\Windows\System32\drivers\etc\hosts file

127.0.0.1 Peer1
127.0.0.1 Peer2

At the same time, we will modify the service provider that is in the above http://www.cnblogs.com/HanShisi/p/8320022.html hello-service configuration slightly

# Service Name, registration center to mark the service
Spring.application.name=hello-service
# Specify the registration center
Eureka.client.serviceurl.defaultzone=http://peer1:1111/eureka/,http://peer2:1112/eureka

The above-mentioned main eureka.client.serviceUrl.defaultZone values have been modified to register this service in Peer1 and Peer2 respectively

Start Eureka-cluster, Eureka-cluster2, and Hello-service separately

respectively through

http://peer1:1111/

http://peer2:1112/

Visit the Registration center

This is where a simple service registry cluster is built.



Spring Cloud Eureka 4 (Highly available service registry)

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.