Giter Club home page Giter Club logo

gateway's Introduction

Gitter Build Status Go Report Card

Gateway

Gateway 是一个基于HTTP协议的restful的API网关。可以作为统一的API接入层。

Note

原先老版本的Gateway不在维护,这个master是基于2.0.0版本,从这个版本开始,不再支持Admin管理UI,不再支持Consul作为元数据存储。元数据的管理提供客户端来管理。可以使用元数据迁移工具 迁移元数据(Cluster、Server、Bind、API)到新版本的gateway上。

Features

  • 流量控制
  • 熔断
  • 负载均衡
  • 服务发现
  • 插件机制
  • 路由
  • API 聚合
  • API 参数校验
  • API 访问控制(黑白名单)
  • API 默认返回值
  • API 定制返回值
  • 后端server的健康检查
  • 使用 fasthttp
  • 开放管理API

Install

更多

Docker

使用 docker pull fagongzi/gateway 命令下载Docker镜像, 使用 docker run -d fagongzi/gateway 运行镜像. 镜像启动后export 3个端口:

  • 80

    Proxy的http端口,这个端口就是直接为终端用户服务的

  • 9092

    APIServer的对外GRPC的端口

架构

组件

Gateway由proxy, apiserver组成

Proxy

Proxy是Gateway对终端用户提供服务的组件,Proxy是一个无状态的节点,可以部署多个来支撑更大的流量,更多

ApiServer

ApiServer对外提供GRPC的接口,用来管理元信息,更多

Gateway中的概念

Server

Server是一个真实的后端服务,更多

Cluster

Cluster是一个逻辑概念,它由一组提供相同服务的Server组成。会依据负载均衡策略选择一个可用的Server,更多

API

API是Gateway的核心概念,我们可以在Gateway的中维护对外的API,以及API的分发规则,聚合规则以及URL匹配规则,更多

Routing

Routing是一个路由策略,根据HTTP Request中的cookie,query string、header中的一些信息把流量分发到指定的Cluster,通过这个功能,我们可以实现AB Test,更多

Gateway能帮助你做什么

API 定义

你可以在Gateway中动态的定义API,这些API可以对应后端服务的一个真实的API或者一组真实的API。并且可以随时上线和下线这些API。

Validation

你可以为每一个API设置一组校验规则,这些校验规则可以动态的修改,并且实时生效。

API Mock

你可以完全Mock一个后端不存在的API或者为一个API作为发生错误的返回默认值,定义返回的JSON数据以及Header、Cookie等信息。使用这个功能可以用来作为后端服务错误(被流控,被降级等)的时候的默认返回值;也可以帮助前端开发人员在开发阶段独立完成功能。

保护后端服务

Gateway 通过 流控 and 熔断 的功能保护后端服务。

AB Test

Gateway 通过 Routing 功能可以做AB测试。

线上引流

Gateway 通过 Routing 功能可以线上引流。

插件机制

Gateway以go1.8的plugin机制提供如下的扩展点

交流方式-微信群

gateway's People

Contributors

ifnfn avatar whaosoft avatar zhangxu19830126 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.