网站首页 > 技术教程 正文
一、apisix介绍
Apache APISIX是一个动态、实时、高性能的 API 网关。APISIX API Gateway提供丰富的流量管理功能,如负载均衡、动态上行、金丝雀发布、熔断、认证、可观察性等。您可以使用APISIX API 网关来处理传统的南北向流量,以及服务之间的东西向流量。它也可以用作k8s 入口控制器。
Apache APISIX 的技术架构:
二、准备环境
1、开启一台操作系统为centos的ec2用于安装apisix相关的服务,开启另外一台ec2搭建wordpress服务。
2、安装 OpenResty 和 Apache APISIX 的RPM仓库
sudo su #切到root用户
yum install -y https://repos.apiseven.com/packages/centos/apache-apisix-repo-1.0-1.noarch.rpm
3、安装etcd
#指定etcd版本
ETCD_VERSION='3.4.18'
#安装wget
yum install wget
#下载
wget https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz
#解压缩
tar -xvf etcd-v${ETCD_VERSION}-linux-amd64.tar.gz && cd etcd-v${ETCD_VERSION}-linux-amd64 && sudo cp -a etcd etcdctl /usr/bin/
#启动etcd服务
nohup etcd >/tmp/etcd.log 2>&1 &
4、安装apisix
#安装指定版本2.13.1-0.el7
yum install apisix-2.13.1-0.el7
5、apisix 相关命令
# 运行以下命令初始化 NGINX 配置文件和 etcd. initialize NGINX config file and etcd
$ apisix init
# generate `nginx.conf` from `config.yaml` and test it
$ apisix test
# 启动 Apache APISIX. start Apache APISIX server
$ apisix start
# 其他命令
# 优雅停机 stop Apache APISIX server gracefully
$ apisix quit
# 强制停机 stop Apache APISIX server immediately
$ apisix stop
# 其他操作 more actions find by `help`
$ apisix help
6、安装apisix-dashboard
yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.13.1/apisix-dashboard-2.13.1-0.el7.x86_64.rpm
#apisix-dashboard启动、查看状态、重启命令
systemctl start apisix-dashboard
systemctl status apisix-dashboard
systemctl restart apisix-dashboard
三、验证
1、登录apisix控制台进行配置,路由以及上游
2、配置nlb
1)target配置
2)创建nlb
3)访问nlb
4)开启nlb的target上面的保留ip
5)开启apisix上的日志递归配置并重启
vim /usr/local/apisix/conf/config-default.yaml
#重启apisix
systemctl restart apisix
6)查看日志( 开启nlb的target上面的保留ip过几分钟才能看到client ip)
7)本地的公网出口ip
注:real_ip_recursive说明
nginx 从 real_ip_header 指令指定的头字段中获取 IP,可能会有多个 IP 值;
- 当 real_ip_recursive 指令值为 off,nginx 从获取到 IP 值中从右往左(也即从后往前)的顺序,以最后一个 IP 值作为客户端的真实 IP ,此时不会排除授信 IP;
- 当 real_ip_recursive 指令值为 on,nginx 从获取到 IP 值中从右往左(也即从后往前)的顺序,排除 set_real_ip_from 指令指定的授信 IP,以最后一个非授信 IP 值作为客户端的真实 IP 。
猜你喜欢
- 2024-10-17 负载均衡获得真实源IP的6种方法(负载均衡 源地址转换)
- 2024-10-17 哎,我早就料到你获取IP地址的姿势不对啦!
- 2024-10-17 JAVA获取运行服务器IP地址的正确写法
- 2024-10-17 如何配置内网IP SSL证书?怎么将IP根证书导入客户端?
- 2024-10-17 三步实现IP地址HTTPS访问(三步打造ip)
- 2024-10-17 IP地址SSL证书获取流程(ssl设备的地址怎么查)
- 2024-10-17 IP地址证书申请教程——六步实现https
- 2024-10-17 爬虫获取代理IP,满足不同的抓取需求
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)