GORB

立体化的 IPVS -- REST API、心跳、服务发现等。「IPVS on steroids – REST API, heartbeats, service discovery and more」

  • 所有者: kobolog/gorb
  • 平台: Docker, Linux, Mac
  • 许可证: GNU Lesser General Public License v3.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

GORB Build Status codecov.io

Go Routing and Balancing

This daemon is an IPVS frontend with a REST API interface. You can use it to control local IPVS instance in the Kernel to dynamically register virtual services and backends. It also supports basic TCP and HTTP health checks (called Gorb Pulse).

  • TCP: tries to establish a TCP connection to the backend's host and port.
  • HTTP: tries to fetch a specified location from backend's host and port.

Backends which fail to pass the health check will have weights set to zero to inhibit any traffic from being routed into their direction. When a backend comes back online, GORB won't immediately set its weight to the previous value, but instead gradually restore it based on backend's accumulated health statistics.

GORB also supports basic service discovery registration via Consul: just pass in the Consul endpoint to GORB and it will take care of everything else – your services will be registered with names like nginx-80-tcp. Keep in mind that you can use Consul's built-in DNS server to make it even easier to discover your services!

Check out these slides for my DockerCon EU 2015 talk for more information about IPVS, GORB and how to use it with Docker.

Configuration

There's not much of a configuration required - only a handlful of options can be specified on the command line:

gorb [-c <consul-address>] [-f flush-pools] [-i interface] [-l listen-address] | -h

By default, GORB will listen on :4672, bind services on eth0 and keep your IPVS pool intact on launch.

REST API

  • PUT /service/<service> creates a new virtual service with provided options. If host is omitted, GORB will pick an
    address automatically based on the configured default device:
{
    "host": "10.0.0.1",
    "port": 12345,
    "protocol": "tcp|udp",
    "method": "rr|wrr|lc|wlc|lblc|lblcr|sh|dh|sed|nq|...",
    "persistent": true,
    "flags": "sh-fallback|sh-port",
}

This scheduler has two flags: sh-fallback, which enables fallback to a different server if the selected server was unavailable, and sh-port, which adds the source port number to the hash computation.

  • PUT /service/<service>/<backend> creates a new backend attached to a virtual service:
{
    "host": "10.1.0.1",
    "port": 12346,
    "method": "nat|tunnel",
    "pulse": {
        "type": "none|tcp|http",
        "args": {
            "method": "GET",
            "port": 54321,
            "path": "/health",
            "expect": 200
        },
        "interval": "5s"
    },
    "weight": 100
}
  • DELETE /service/<service> removes the specified virtual service and all its backends.
  • DELETE /service/<service>/<backend> removes the specified backend from the virtual service.
  • GET /service/<service> returns virtual service configuration.
  • GET /service/<service>/<backend> returns backend configuration and its health check metrics.
  • PATCH /service/<service> update virtual service configuration.
  • PATCH /service/<service>/<backend> update backend configuration and its health check metrics.

For more information and various configuration options description, consult man 8 ipvsadm.

Development

Use glide to install dependencies:

glide install -v

This should be done periodically to retrieve any updated dependencies.

TODO

  • Add more options for Gorb Pulse: thresholds, exponential back-offs and so on.
  • Support for IPVS statistics (requires GNL2GO support first).
  • Support for FWMARK & DR virtual services (requires GNL2GO support first).
  • Add service discovery support, e.g. automatic Consul service registration.
  • Add BGP host-route announces, so that multiple GORBs could expose a service on the same IP across the cluster.
  • Add some primitive UI to present the same action palette but in an user-friendly fashion.
  • Replace command line options with proper configuration via a JSON/YAML/TOML file.

主要指标

概览
名称与所有者kobolog/gorb
主编程语言Go
编程语言Go (语言数: 5)
平台Docker, Linux, Mac
许可证GNU Lesser General Public License v3.0
所有者活动
创建于2015-10-21 18:04:08
推送于2024-04-28 16:48:32
最后一次提交2024-04-28 18:48:32
发布数0
用户参与
星数815
关注者数54
派生数81
提交数157
已启用问题?
问题数28
打开的问题数3
拉请求数25
打开的拉请求数0
关闭的拉请求数5
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?