Spring Cloud Eureka Server and client based on spring Boot 2.0.3

Source: Internet
Author: User

springbootversion = ' 2.0.3.RELEASE '

springcloudversion = ' Finchley.release '

1. Service Discovery and Service registration

Service discovery: How can I provide a service to the client? The client is looking for it, or the server side helps it find it.
Client discovery: The client queries the service registry and then uses the load balancing algorithm to select an instance from and make a request.
Server-side discovery: The client requests a service through a load balancer, the load Balancer queries the service registry, and forwards the request to the available service instances.
Service registration:
Self-registration: service instance registering itself
Third-party registration mode: The service Registrar tracks changes to the running instance by querying the deployment environment or subscribing to events. Once a new available service instance is detected, the service is registered with the registry. Service Manager is also responsible for unregistering terminated service instances.

2. Region and Zone

Region: Based on geographic location we refer to an area's infrastructure services collection as an area. The AWS region allows AWS Cloud services to be geographically closer to our users, while allowing users to choose from different areas to store their data to meet local regulatory compliance requirements.
Each region of the availability zone:aws is typically made up of multiple availability zones (AZ), and an availability zone typically consists of multiple data centers. AWS introduces an availability zone design primarily to improve the high availability of user applications. Because the availability zone and the availability zone are designed to be independent of each other, that is, they will have independent power supply, independent network, etc., so that if an availability zone problems, it will not affect the other availability zone.

Feel is the concept of disaster recovery backup, such as a company in Beijing has two rooms, one in the village, one in the land, each room has a Eureka server, the two Eureka Server region and zone configuration

Eureka Server1

Region:beijing

Zone:yizhuang

Eureka Server2

Region:beijing

Zone:shangdi

3. Eureka Architecture

4, Eureka actual combat

"Simplest Eureka Server"
1) Main class
@EnableEurekaServer
2) application.yml (Standalone Eureka Server)


port:8761




False
False

Defaultzone:http://${eureka.instance.hostname}:${server.port}/eureka/

Enter http://localhost:8761/in the browser

3) Reliance
Compile (' Org.springframework.cloud:spring-cloud-starter-netflix-eureka-server')

If Gradle cannot find the Eureka package , add the following in Build.gradle
Reason: Due to Gradle ' s dependency resolution rules and the lack of a parent BOM feature

ext {springcloudversion = ' finchley.release '}dependencymanagement {imports {Mavenbom ' org.springframework.cloud:sp Ring-cloud-dependencies:${springcloudversion} "}}

"Registration service to Eureka Sever"
1) Main class
@EnableEurekaClient
@EnableDiscoveryClient more general, not limited to Eureka
2.0 does not need to add this annotation , as long as the classpath has spring-cloud-starter-netflix-eureka-client.

2) application.yml

spring:application:name:user-serviceeureka:client:serviceUrl:defaultZone:http:/ /localhost:8761/eureka/

3) Reliance

Compile (' org.springframework.cloud:spring-cloud-starter-netflix-eureka-client ')
If Gradle cannot find Eureka package, Due to Gradle's dependency resolution rules and the lack of a parent BOM feature

See the related configuration for Build.gradle in Eureka Server.

Spring Cloud Eureka Server and client based on spring Boot 2.0.3

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.