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