Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Dubbo Cloud Native: To Add Service registration and discovery abstract #3942

Closed
mercyblitz opened this issue Apr 28, 2019 · 1 comment
Assignees
Milestone

Comments

@mercyblitz
Copy link
Contributor

mercyblitz commented Apr 28, 2019

Abstract

Dubbo Cloud Native requires an abstract for Service registration and discovery that will support Dubbo application as a whole service registering to a registry instead of Dubbo service interfaces.

Concepts

It will introduce some new concepts:

  • Dubbo Service name(a.k.a Dubbo Application name)
    The name of Dubbo application is unique in the current application and the registry, which could be configured by the externalized property dubbo.application.name or set by ApplicationConfig directly.

  • Dubbo Service instance
    The minimum Dubbo registration unit must include:

    • service name: a.k.a Dubbo Application name that current service instance belongs to
    • hostname: The IP or hostname of the current service instance
    • service port: The port Dubbo services export
    • metadata: the metadata of the current instance, e.g, management port.
  • Dubbo Service registry
    Being different from the traditional Dubbo registry, Dubbo Application registry only accepts current Dubbo applications' registration, is like Spring Cloud Registry, and the metadata of Dubbo services will reside in their self-application.

  • Dubbo Service discovery
    It provides a mechanism to discovery Dubbo applications and Dubbo Service interfaces.

@chickenlj
Copy link
Contributor

应用粒度注册

服务注册与发现

image

解决微服务拆分的问题

如应用app1一拆为二:app1、app3,面向application的服务发现无法监听新增的app3,可能导致地址无法推送、服务接口调用失败。

**解决方案:**中心化存储中增加interface -> application映射关系,消费端同时监听interfaces、services下的两级目录

  • 对于Dubbo面向接口的服务发现与调用,为了做到让用户侧无需感知应用拆分,额外保存interfaces数据
  • 对于微服务面向应用,用户需明确感知应用拆分
    image

实例节点元数据

{
  endpoints: [{protocol, ip, port}, {protocol, ip, port}]
  // 实例环境标
  weight:100,
  version:v1,
  environment:test
}

MetadataService

  1. 接口定义(初步设想)
public interface DubboMetadataService {
    String VERSION = "1.0.0";

    String getVersion(); //如果要做版本隔离:metadataservice定义就需要注册到注册中心,或者就需要遍历每个实例的getVersion()

    List<String> getExportedUrls();

    List<String> getReferedUrls();

    String getExportedURLs(String serviceInterface, String group, String version);

    String getExportedURLs(String serviceInterface);
}
  1. 暴露

    • 与标准Dubbo、REST协议共用端口,多协议暴露的情况下,metadataservice在每个端口都暴露?

    • MetaddataService元数据可开放配置项,但是不往注册中心注册。

    • 使用标准Protocol、ProxyFactory暴露服务,参考DubboMonitorFactory关于MonitorService的做法

  2. 监听

  • 实例按版本号分组,版本号是根据provider端的元数据(interface、method签名等)自动计算出来的,并在每次实例重启时注册到注册中心实例的元数据中。
  • Online/offline 某个接口的解决方法?

使用方式

关键信息:消费的application列表、application和reference的包含关系、registry注册模式

  • Dubbo内互调,注册中心额外维护interface -> application映射关系。
    <dubbo:reference interface="org.xxx.DemoService" />
  • 微服务互通,指定provider应用名
    <dubbo:reference interface="org.xxx.DemoService" service="app-name"/>

迁移与改造

<!-- 迁移需要定义两个registry,默认是老的注册模型,使用新模型加mode=application参数 -->
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181?mode=application"/>

<!-- 终态。某个版本开始默认以新的模型做服务注册发现 -->
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>

元数据存储

ApplicationModel

注册中心

  • 注册,应用级事件,在元数据、端口监听完成后,写入到注册中心一次;多注册中心则注册多份
  • 监听,在应用级监听,每个注册中心都做监听;监听应在refer之前,refer过程采集接口元数据

定义一套新的应用级别的服务发现接口,用于实现面向应用的Registry和DiscoveryClient,驱动老的Regsitry接口与MetadataService的对接,以实现复用老的URL运转流程

裸的API方式需要一个统一的启动入口,以实现应用级别的服务暴露与注册,Spring的事件入口,如ContextRefreshedEvent?代理到API入口

@chickenlj chickenlj reopened this May 10, 2019
mercyblitz added a commit to mercyblitz/dubbo that referenced this issue May 20, 2019
@mercyblitz mercyblitz removed their assignment May 23, 2019
@mercyblitz mercyblitz modified the milestones: 2.7.2, 2.7.3 May 23, 2019
@mercyblitz mercyblitz self-assigned this May 23, 2019
mercyblitz added a commit to mercyblitz/dubbo that referenced this issue May 31, 2019
mercyblitz added a commit to mercyblitz/dubbo that referenced this issue Jun 7, 2019
@chickenlj chickenlj modified the milestones: 2.7.3, 2.7.4 Jun 18, 2019
mercyblitz pushed a commit that referenced this issue Jun 26, 2019
* Polish apache/incubator-dubbo/#4096 : To add new module for Dubbo Event

* Polish #3942 : Dubbo Cloud Native: To Add Service registration and discovery abstract

* Polish #3946 : Dubbo Cloud Native : To Add Dubbo metadata service

* Polish #4093 : To add exported and unexported events for ServiceConfig

* Polish #3984 : Add Service registration and discovery implementation for Zookeeper

* Polish #4104 : To add initialized and destroyed events for ReferenceConfig

* Polish #3946 : Refactor Dubbo metadata service

* Polish #3946 : To Add MetadataServiceExporter into dubbo-config-api

* Update ${project.parent.version}

* Polish #3946 : Refactor Dubbo metadata service

* Polish apache/incubator-dubbo/#4096 : Remove the duplicated word

* Polish #4119 : DynamicConfiguration adds the publish and multiple get configuration methods

* Polish #4120 : To add DynamicConfiguration implementation for Zookeeper

* Polish #4121 : Add the mapping from service metadata to service name

* Polish apache/incubator-dubbo/#3790 : Dependencies with no license

* Polish #4071 : @reference can't match the local @service beans

* Update version to be 2.7.3

* Polish #3946 : Add thread-safe and performance optimization

* Polish #3946 : Add thread-safe and performance optimization

* Polish #3946 : Add thread-safe and performance optimization

* Update 2.7.3

* Polish #4104 : To add more events for dubbo-config-api

* Polish #3942 : Dubbo Cloud Native: To Add Service registration and discovery abstract

* Polish #3984 : Add Service registration and discovery implementation for Zookeeper

* Add Bootstrap

* Polish GA

* Polish #4050 : Dubbo Cloud Native : Add a mechanism to upgrade Dubbo services smoothly

* Polish #4093 : To add DubboServiceDestroyedEvent

* Polish #4050 : Dubbo Cloud Native : Reactor

* Polish #3946 : Remove SPI

* Polish #4265 : [Feature] Dubbo Cloud Native - Add Bootstrap

* Polish #4265 : [Feature] Dubbo Cloud Native - Add Bootstrap

* Polish #4265 : Add test dependencies

* Polish /#3942 : Refactor implementation

* Polish #3984 : Refactor

* Add Nacos implementation

* Polish #3984 : Add Nacos implementation

* Polish #4268 : Dubbo Event - To support Generic event type handle

* Polish #4268 : Update JavaDoc

* Polish #4268 : Add GenericEventListener implementation

* add cache for MetadataServiceProxy

* support multiple metadata and configcenter

* unify metadata implementation

* add missed files

* remove duplicated files

* add new SPIs and modules to dubbo-all pom.
@mercyblitz mercyblitz modified the milestones: 2.7.4, 2.7.5 Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants