介绍
极限网关 (INFINI Gateway) 是一个面向 Elasticsearch 的高性能应用网关,它包含丰富的特性,使用起来也非常简单。极限网关工作的方式和普通的反向代理一样,我们一般是将网关部署在 Elasticsearch 集群前面, 将以往直接发送给 Elasticsearch 的请求都发送给网关,再由网关转发给请求到后端的 Elasticsearch 集群。因为网关位于在用户端和后端 Elasticsearch 之间,所以网关在中间可以做非常多的事情, 比如可以实现索引级别的限速限流、常见查询的缓存加速、查询请求的审计、查询结果的动态修改等等。
特性
极限网关是专为 Elasticsearch 而量身打造的应用层网关,地表最强,没有之一!
高可用,不停机索引,自动处理后端 Elasticsearch 的故障,不影响数据的正常摄取
写入加速,可自动合并独立的索引请求为批量请求,降低后端压力,提高索引效率
查询加速,可配置查询缓存,Kibana 分析仪表板的无缝智能加速,全面提升搜索体验
透明重试,自动处理后端 Elasticsearch 节点故障和对查询请求进行迁移重试
流量克隆,支持复制流量到多个不同的后端 Elasticsearch 集群,支持流量灰度迁移
一键重建,优化过的高速重建和增量数据的自动处理,支持新旧索引的透明无缝切换
安全传输,自动支持 TLS/HTTPS,可动态生成自签证书,也可指定自签可信证书
精准路由,多种算法的负载均衡模式,索引和查询可分别配置负载路由策略,动态灵活
限速限流,支持多种限速和限流测规则,可以实现索引级别的限速,保障后端集群的稳定性
并发控制,支持集群和节点级别的 TCP 并发连接数控制,保障后端集群和节点稳定性
无单点故障,内置基于虚拟 IP 的高可用解决方案,双机热备,故障自动迁移,避免单点故障
请求透视,内置日志和指标监控,可以对 Elasticsearch 请求做全面的数据分析
安装步骤
cd /opt/
[root@test13 opt]# mkdir es-gateway
[root@test13 opt]# cd es-gateway/
[root@test13 es-gateway]# wget http://release.elasticsearch.cn/gateway/snapshot/gateway-1.2.0_SNAPSHOT-237-linux64.tar.gz
[root@test13 es-gateway]# tar zxvf gateway-1.2.0_SNAPSHOT-237-linux64.tar.gz
验证下载脚本
[root@test13 es-gateway]# ./gateway-linux64 --help
Usage of ./gateway-linux64:
-config string
the location of config file, default: gateway.yml (default "gateway.yml")
-cpu int
the number of CPUs to use (default -1)
-cpuprofile string
write cpu profile to this file
-daemon
run in background as daemon
-debug
run in debug mode, gateway will quit with panic error
-log string
the log level,options:trace,debug,info,warn,error (default "info")
-memprofile string
write memory profile to this file
-pidfile string
pidfile path (only for daemon mode)
-pprof string
enable and setup pprof/expvar service, eg: localhost:6060 , the endpoint will be: http://localhost:6060/debug/pprof/ and http://localhost:6060/debug/vars
-v version
[root@test13 es-gateway]# mkdir bin
[root@test13 es-gateway]# mv gateway-linux64 bin/gateway
[root@test13 es-gateway]# mkdir /etc/gateway
创建配置文件
[root@test13 es-gateway]# vim /etc/gateway/gateway.yml
保存内容
path.data: data
path.logs: log
vi /usr/lib/systemd/system/gateway.service
[Unit]
Description=infini-gateway
After=network.target
[Service]
Type=forking
WorkingDirectory=/opt/es-gateway
ExecStart=/opt/es-gateway/bin/gateway -daemon -pidfile /var/run/gateway.pid -config /etc/gateway/gateway.yml
ExecStop=/bin/kill `cat /var/run/gateway.pid`
PrivateTmp=true
User=root
Group=root
LimitNOFILE=16384:163840
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start gateway
查看状态
[root@test13 es-gateway]# systemctl status gateway
● gateway.service - infini-gateway
Loaded: loaded (/usr/lib/systemd/system/gateway.service; disabled; vendor preset: disabled)
Active: active (running) since 五 2021-06-25 14:00:01 CST; 4s ago
Process: 16995 ExecStart=/opt/es-gateway/bin/gateway -daemon -pidfile /var/run/gateway.pid -config /etc/gateway/gateway.yml (code=exited, status=0/SUCCESS)
Main PID: 17004 (gateway)
CGroup: /system.slice/gateway.service
└─17004 /opt/es-gateway/bin/gateway -daemon -pidfile /var/run/gateway.pid -config /etc/gate...
6月 25 14:00:01 test13 systemd[1]: Starting infini-gateway...
6月 25 14:00:01 test13 gateway[16995]: ___ _ _____ __ __ __ _
6月 25 14:00:01 test13 gateway[16995]: / _ \ /_\ /__ \/__\/ / /\ \ \/_\ /\_/\
6月 25 14:00:01 test13 gateway[16995]: / /_\///_\\ / /\/_\ \ \/ \/ //_\\\_ _/
6月 25 14:00:01 test13 gateway[16995]: / /_\\/ _ \/ / //__ \ /\ / _ \/ \
6月 25 14:00:01 test13 gateway[16995]: \____/\_/ \_/\/ \__/ \/ \/\_/ \_/\_/
6月 25 14:00:01 test13 gateway[16995]: [GATEWAY] A light-weight, powerful and high-performance el...way.
6月 25 14:00:01 test13 gateway[16995]: [GATEWAY] 1.2.0_SNAPSHOT, 65606c7, Fri Jun 18 21:44:25 202...vice
6月 25 14:00:01 test13 gateway[16995]: [GATEWAY] started in background, pid: 16996
6月 25 14:00:01 test13 systemd[1]: Started infini-gateway.
Hint: Some lines were ellipsized, use -l to show in full.
本文由博客一文多发平台 OpenWrite 发布!