Easegress servers as a reverse proxy. It can easily integrate with mainstream Service Registries.
name: pipeline-reverse-proxy
kind: Pipeline
flow:
- filter: proxy
filters:
- name: proxy
kind: Proxy
pools:
- servers:
- url: http://127.0.0.1:9095
- url: http://127.0.0.1:9096
- url: http://127.0.0.1:9097
loadBalance:
policy: roundRobin
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.
- 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
- Create a pipeline and set its
serviceRegistry
field intozookeeper-001
and it will look up the zookeeper configuration for the service namedspringboot-application-order
as in fieldserviceName
.
name: pipeline-reverse-proxy
kind: Pipeline
flow:
- filter: proxy
filters:
- name: proxy
kind: Proxy
pools:
- servers:
- url: http://127.0.0.1:9095
- url: http://127.0.0.1:9096
- url: http://127.0.0.1:9097
serviceRegistry: zookeeper-001 # +
serviceName: springboot-application-order # +
loadBalance:
policy: roundRobin
- First we need to create a ConsulServiceRegistry in Easegress
kind: ConsulServiceRegistry
name: consul-001
address: '127.0.0.1:8500'
scheme: http
syncInterval: 10s
- Create a pipeline and set its
serviceRegistry
field intoconsul-001
and it will look up the consul configuration for the service namedspringboot-application-order
as in fieldserviceName
.
name: pipeline-reverse-proxy
kind: Pipeline
flow:
- filter: proxy
filters:
- name: proxy
kind: Proxy
pools:
- servers:
- url: http://127.0.0.1:9095
- url: http://127.0.0.1:9096
- url: http://127.0.0.1:9097
serviceRegistry: consul-001 # +
serviceName: springboot-application-order # +
loadBalance:
policy: roundRobin
- First we need to create a EurekaServiceRegistry in Easegress
kind: EurekaServiceRegistry
name: eureka-001
endpoints: ['http://127.0.0.1:8761/eureka']
syncInterval: 10s
- Create a pipeline and set its
serviceRegistry
field intoeureka-001
and it will look up the eureka configuration for the service namedspringboot-application-order
as in fieldserviceName
.
name: pipeline-reverse-proxy
kind: Pipeline
flow:
- filter: proxy
filters:
- name: proxy
kind: Proxy
pools:
- servers:
- url: http://127.0.0.1:9095
- url: http://127.0.0.1:9096
- url: http://127.0.0.1:9097
serviceRegistry: eureka-001 # +
serviceName: springboot-application-order # +
loadBalance:
policy: roundRobin