Skip to content

Latest commit

 

History

History
138 lines (111 loc) · 3.83 KB

service-proxy.md

File metadata and controls

138 lines (111 loc) · 3.83 KB

Service Proxy

Easegress servers as a reverse proxy. It can easily integrate with mainstream Service Registries.

Basic: Load Balance

name: pipeline-reverse-proxy
kind: HTTPPipeline
flow:
  - filter: proxy
filters:
  - name: proxy
    kind: Proxy
    mainPool:
      servers:
      - url: https://127.0.0.1:9095
      - url: https://127.0.0.1:9096
      - url: https://127.0.0.1:9097
      loadBalance:
        policy: roundRobin

Dynamic: Integration with Service Registry

  • We integrate Proxy with service registries such as Consul, Etcd, Zookeeper, Eureka. You need to create one of them to connect the external service registry. The service registry config takes higher priority than static servers. If the dynamic servers pulling failed, it will use static servers if there are.

Zookeeper

  1. First we need to create a ZookeeperServiceRegistry in Easegress
kind: ZookeeperServiceRegistry
name: zookeeper-001
zkservices: [127.0.0.1:2181]
prefix: /services
conntimeout: 6s
syncInterval: 10s
  1. Create a pipeline and set its serviceRegistry field into zookeeper-001 and it will look up the zookeeper configuration for the service named springboot-application-order as in field serviceName.
name: pipeline-reverse-proxy
kind: HTTPPipeline
flow:
  - filter: proxy
filters:
  - name: proxy
    kind: Proxy
    mainPool:
      servers:
      - url: https://127.0.0.1:9095
      - url: https://127.0.0.1:9096
      - url: https://127.0.0.1:9097
      serviceRegistry: zookeeper-001              # +
      serviceName: springboot-application-order   # +
      loadBalance:
        policy: roundRobin

Consul

  1. First we need to create a ConsulServiceRegistry in Easegress
kind: ConsulServiceRegistry
name: consul-001
address: '127.0.0.1:8500'
scheme: http
syncInterval: 10s
  1. Create a pipeline and set its serviceRegistry field into consul-001 and it will look up the consul configuration for the service named springboot-application-order as in field serviceName.
name: pipeline-reverse-proxy
kind: HTTPPipeline
flow:
  - filter: proxy
filters:
  - name: proxy
    kind: Proxy
    mainPool:
      servers:
      -