Coder Social home page Coder Social logo

ayb-registry's Introduction

ayb-registry

之前我写了一个Rpc框架,为了配合我的Rpc框架,我模仿了nacos的部分设计**,实现了ayb-registry注册中心 目前服务端功能基本实现,客户端仅基本功能实现。后面可能还会继续实现负载均衡,配置中心等功能......

主要流程:

服务端-客户端:

  1. 客户端启动向服务端登记服务,服务端会将服务信息,放入消息队列中,统一进行异步处理;
  2. 服务会在消息队列中依次处理,更新服务列表,并且通知集群数据变更;
  3. 同时客户端开启心跳定时任务,服务端开启心跳检测定时任务;
  4. 客户端可以发送请求订阅某个服务,当该服务发生变更时,服务端会通过UDP主动推送服务信息到客户端中;
  5. 客户端可以从服务端获取指定服务列表;

集群节点间:

  1. 集群间采用AP模式的Distro协议;
  2. 每个节点都可以独立处理读请求;
  3. 需要特定的节点处理特定的写请求,同时同步到其他集群中;其中使用Filter将写请求路由到指定的节点中;
  4. 节点启动后,会向其他节点请求拉取数据快照,同时开启集群心跳任务;

主要功能:

  • 服务注册:Client端在启动后会向Server端发送请求登记服务。如果为Server集群的情况会路由到指定的Server端处理请求。
  • 服务心跳:Client端登记服务后,每个5秒会发送一个心跳到Server端以确保服务可用,如果超过15秒没有收到心跳,则该服务会被设置为不健康;超过30秒后,会剔除该服务。
  • 服务订阅:Client端需要将要订阅的服务告知Server端,当Client端订阅的服务发生变更后,Server端会将变更服务主动推送到Client端
  • 服务发现:Client端指定服务名发送请求到Server端,Server端会响应服务列表。
  • 集群同步:某个Server端节点启动后,会向各个节点拉取数据快照,直到数据拉取成功。某个Server端节点管理的指定的数据发生更改后,会将更改的数据同步的别的节点中。
  • 集群心跳:Server集群节点间每隔5秒会互相发送心跳,如果发送响应失败,则将该节点从健康列表中剔除。

ayb-registry's People

Contributors

uncharted404 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.