Eureka server is highly available

Source: Internet
Author: User

Eureka server is registering with each other to achieve a highly available deployment , so we only need to configure the Eureke server with other available serviceurl to enable a highly available deployment

    • Create application-peer1.properties , configure as a Peer1 service center, and point Serviceurl to Peer2
    • spring.application.name=eureka-serverserver.port=1111eureka.instance.hostname=peer1# Point to another registration center Eureka.client.serviceUrl.defaultZone=http://peer2:1112/eureka/
    • Create application-peer2.properties as a configuration for the Peer2 Service Center and Point Serviceurl to Peer1
    •  Spring.application.name=eureka-serverserver.port  = 1112 eureka.instance.hostname  =peer2# Point to another registry Eureka.client.serviceUrl.defaultZone  =http:// peer1:1111/eureka/ 

        hosts file

    •  127.0.0.1 Peer1  127.0.0.1 peer2 
    • Peer1 and Peer2 are started separately through the spring.profiles.active property
    •  java-jar eureka-server-1.0.0.jar--spring.profiles.active=peer1java  -jar Eureka-server-1.0.0.jar--spring.profiles.active=peer2 

       

At this point, access to Peer1 's registry: http://localhost:1111/。 registered-replicas There are already peer2 nodes in the Eureka-server.

Similarly, access to Peer2 's registry: http://localhost:1112/ registered-replicas There are already peer1 nodes in the, and these nodes are in the available shards (available-replicase).

We can also try to turn off Peer1, refresh http://localhost:1112/ , peer1 node becomes unusable shard (Unavailable-replicas).

Service Registration and Discovery
pring.application.name=compute-serviceserver.port=2222eureka.client.serviceUrl.defaultZone= http://peer1:1111/eureka/,http://peer2: 1112/eureka/

How to configure Serviceurl to synchronize services in a cluster

Eureka server synchronization follows a very simple principle: information can be propagated and synchronized as long as one side connects the nodes

Scene One

Assuming we have 3 registries, we will Peer1, Peer2, and Peer3 each point serviceurl to another two nodes. In other words, Peer1, Peer2 and Peer3 are 22 registered with each other. Start the three service registries and point the Compute-service serviceurl to Peer1 and start to get the cluster effect as shown.

Access http://localhost:1112/ , you can see 3 registries composed of clusters, compute-service services through Peer1 synchronization to the mutual registration of Peer2 and Peer3

Summarize:
    • 22 The method of registration can realize the full equivalence of nodes in the cluster, achieve the highest availability cluster, and no one registry fault will affect the registration and discovery of the service.

Eureka server is highly available

Related Article

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.