SpringCloud Study Notes (5) -- Eureka high availability, springcloudeureka

Source: Internet
Author: User

SpringCloud Study Notes (5) -- Eureka high availability, springcloudeureka

See sections 12th, 12.3, and 12.5 of Spring Cloud official documents

12.3 High Availability, Zones and Regions

By default, each Eureka server is also an Eureka client and requires at least one service URL that matches it. If you do not provide such a peering service, it can also run and work, but it will keep telling you through logs that you have not registered to a peering service.

12.5 Peer Awareness

Eureka is more flexible and available by running multiple instances and requiring them to register with each other. In fact, this is the default action, so what you need to do is to specify a valid serviceUrl for the peering service to make it better work.

In this example, we deploy the same service on two inaccessible machines (peer1 and peer2) and specify inaccessible Spring profiles to use the same YAML file.

You can add multiple peer nodes as long as they are connected to each other and have at least one edge. (PS: I understand that an edge here must have at least two nodes, because the two points form a straight line) They synchronize their registration information.

12.6 Prefer IP Address

In some cases, it is better to publish the IP address of the Eureka server instead of the host name. Set eureka. instance. preferIpAddress to true, and use the IP address instead of the host name when the application registers with Eureka.

 

Code on

Deployed on two machines, one physical machine 192.168.1.1 and one virtual machine 192.168.1.128

Engineering Structure

Configuration

Package

Start separately

Start the user-service Project

In this example, you can write the two segments in one file separately.

 

Slightly modify the configuration, and the final result is as follows:

 

Reference

Https://www.cnblogs.com/sweetchildomine/p/6980054.html

Http://blog.didispace.com/springcloud6/

Http://blog.csdn.net/pangpengshuai/article/details/58606390

Http://blog.csdn.net/gobitan/article/details/76548929

Http://blog.csdn.net/hry2015/article/details/78245149

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.