Sign inSign up

infinilabs/gateway

By infinilabs

•Updated about 9 hours ago

INFINI Gateway, a high performance, powerful and lightweight gateway for elasticsearch.

Image
API management
Developer tools
Web servers
3

50K+

infinilabs/gateway repository overview

⁠INFINI Gateway

Full Documentation⁠

⁠Introduction

INFIN Gateway is a high performance and rich featured gateway for elasticsearch. A gateway is like a proxy, usually deployed in front of the elasticsearch clusters, all your elasticsearch requests send to gateway first instead of sending to elasticsearch directly. The gateway could perform filtering, throttling, caching, manipulating and lot's of other functionality on each request as you wish.

⁠Features

  • Auto handling upstream failure while indexing, aka nonstop indexing
  • Auto detect upstream failure and retry in search
  • Multiple write mechanism, map indexing to multi elasticsearch clusters
  • Support TLS/HTTPS, generate the cert files automatically
  • Support run background as daemon mode(only available on linux and macOS)
  • Auto merge indexing operations to single bulk operation
  • Load balancing(indexing and search request), algorithm configurable
  • A controllable query cache layer, speedup hottest queries
  • Index level request throttling, based on bucket window size
  • Concurrent throttling, limit the num of connections to upstream
  • Builtin floating IP, support seamless failover and rolling upgrade (On premise only)
  • Request logging and observability, provide curated Kibana dashboard
  • Multi elasticsearch cluster data replication and traffic control

⁠Getting Started

⁠Pull the image use a specific tag
# IMPORTANT: Use a specific tag (e.g., 1.29.0) instead of 'tag'.  See Docker Hub for available tags.
docker pull infinilabs/gateway:tag
⁠Create a gateway.yml config file
path.data: data
path.logs: log

entry:
  - name: my_es_entry
    enabled: true
    router: my_router
    max_concurrency: 200000
    network:
      binding: 0.0.0.0:8000
flow:
  - name: simple_flow
    filter: #comment out any filter sections, like you don't need cache or rate-limiter
      - elasticsearch:
          elasticsearch: dev  #elasticsearch configure reference name
router:
  - name: my_router
    default_flow: simple_flow

elasticsearch:
- name: dev
  enabled: true
  endpoint: http://localhost:9200
  basic_auth:
    username: test
    password: testtest

!Note! It's import to configure the elasticsearch section with your own elasticsearch connection;

⁠Start INFINI Gateway
docker run -p 8000:8000  -p 2900:2900   -v=`pwd`/gateway.yml:/gateway.yml  infinilabs/gateway:1.29.0 

If no exception, you will see message like this:

➜  /tmp docker run -p 8000:8000  -v=`pwd`/gateway.yml:/gateway.yml  infinilabs/gateway:1.29.0
   ___   _   _____  __  __    __  _       
  / _ \ /_\ /__   \/__\/ / /\ \ \/_\ /\_/\
 / /_\///_\\  / /\/_\  \ \/  \/ //_\\\_ _/
/ /_\\/  _  \/ / //__   \  /\  /  _  \/ \ 
\____/\_/ \_/\/  \__/    \/  \/\_/ \_/\_/ 

[GATEWAY] A light-weight, powerful and high-performance elasticsearch gateway.
[GATEWAY] 1.0.0_SNAPSHOT, b61758c, Mon Dec 28 14:32:02 2020 +0800, medcl, no panic by default
[12-30 05:26:41] [INF] [instance.go:24] workspace: data/gateway/nodes/0
[12-30 05:26:41] [INF] [runner.go:59] pipeline: primary started with 1 instances
[12-30 05:26:41] [INF] [entry.go:257] entry [es_gateway] listen at: http://0.0.0.0:8000
[12-30 05:26:41] [INF] [app.go:247] gateway now started.
[12-30 05:26:45] [INF] [reverseproxy.go:196] elasticsearch [prod] endpoints: [] => [192.168.3.201:9200]
[12-30 05:26:51] [INF] [reverseproxy.go:196] elasticsearch [prod] endpoints: [192.168.3.201:9200] => [192.168.3.202:9200, 192.168.3.203:9200, 192.168.3.201:9200]
⁠Rock with INFINI Gateway

And you can access the proxy endpoint http://localhost:8000/, like this:

➜  /tmp curl -v http://localhost:8000/
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8000 (#0)
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.64.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: INFINI
< Date: Wed, 30 Dec 2020 05:12:39 GMT
< Content-Type: application/json; charset=UTF-8
< Content-Length: 480
< UPSTREAM: 192.168.3.201:9200
< 
{
  "name" : "node1",
  "cluster_name" : "pi",
  "cluster_uuid" : "Z_HcN_6ESKWicV-eLsyU4g",
  "version" : {
    "number" : "6.4.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "04711c2",
    "build_date" : "2018-09-26T13:34:09.098244Z",
    "build_snapshot" : false,
    "lucene_version" : "7.4.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
* Connection #0 to host localhost left intact
* Closing connection 0

Have fun!

⁠Who is using?

If you are using INFINI GATEWAY and happy to tell others that you are using, please leave message to this Github issue⁠, we'd happy to list you here.

Users

Tag summary

Content type

Image

Digest

sha256:bceddf773…

Size

19.3 MB

Last updated

about 9 hours ago

docker pull infinilabs/gateway:1.32.0_NIGHTLY-20261004