Micro registry services
author:QYX
Registry can be said that the micro-service architecture address book, which records the mapping between the service and the service address, in a distributed architecture, the service will be registered here, when the service need to call other services
Here you will find information and services, call
The main role of the registry
A service registry is a very important component in the micro-service architecture, micro-architecture in the service played a major role coordinator, registry generally includes the following functions:
1, service discovery:
Service registry / unregister : Save the information service provider and service caller
Service Subscribe / unsubscribe: those who subscribe to the service call information service providers, the best real-time push function
Service Routing (optional ): the ability to integrate screening service provider
2, Service Configuration
Configure the subscription : the service provider and service subscription caller micro-services-related configuration
Configuration issued : take the initiative to push the configuration to the service provider and service callers
3, service health monitoring
Testing services provider health
Common registry
zookeeper
dubbo recommended as a zookeeper registry
Eureka
Widely Spring Cloud System Application
Consul
Go language development, support for multiple distributed high-availability data center services to publish and registration services, the use of consistency we know ralt algorithm to ensure services and supports health check
nacos
As a Nacos miscellaneous just want to say ah 6666, Nacos is easier to build a dynamic cloud-native application service discovery, configuration management and service management platform to platform, Spring Cloud Alibaba,
Eureka is a service discovery framework Netfilx development, SpringCloud to integrate it in their own subprojects spring-cloud-netfilx, the realization SpringCloud service discovery
The figure briefly describes the basic architecture of Eureka, composed of three roles
1 Eureka Server
提供服务注册和发现
2 Service Provider
服务提供方
将自身服务注册到Eureka,从而使服务消费方能够找到
3 Service Consumer
服务消费方
从Eureka获取注册服务列表,从而能够消费服务
工作原理:
服务提供者开启时向Eureka Server注册实例,Eureka Server会将服务提供者的注册信息放入到内存中,且默认每30秒对服务提供者进行心跳检测,如果超过30秒则视为宕机,则删除内存中的注册信息
服务消费方从Eureka Server中获取注册信息,并保存到本地的内存中,并通过注册信息与服务提供者进行通讯,这里可能会引起一致性问题,因为假如Eureka Server的检测到服务提供者宕机则会删除内存
而服务消费者却还保存内存,这就引起了一致性问题,所有Eureka在CAP理论中(C 一致性 A 可用性 P 分区容错性)中只满足AP
Eureka总体介绍
我们的服务发现一般分为两种模式一种为客户端发现模式(我们主要讲这个),一种为服务端发现模式
服务实例的网络位置都是动态分配的,而且因为扩展,失效和升级等需求,服务实例会常常发生动态改变,因此客户端一种更加复杂的服务发现机制
当使用客户端发现模式时,客户端负责决定相应服务实例之间的网络位置,并且对请求实现负载均衡,客户端从一个服务注册服务中查询,其中是所有可用服务实例的库,客户端使用负载均衡算法对从多个服务实例中选择出一个,然后发出请求
本人的分布式框架也已经开源请大家多多支持啊!