赞
踩
APISIX 是一个微服务API网关,具有高性能、可扩展性等优点。它基于 nginx(openresty)和 Lua 实现功能,借鉴了Kong的思路,将Kong底层的关系型数据库(Postgres)替换成了NoSQL型的 etcd,这使得 APISIX 相较于 Kong 在性能上有了很大提升,在启用各类插件的情况下,Apache APISIX 的性能据说是 Kong 的 10 倍,极具吸引力。
且相较于 Kong 来说,源码更为简洁,二次开发难度更低,但是相对的,开源时间较短,在插件功能完备性上不如Kong,比如缺少关于灰度相关的插件,但是其已纳入Apache 基金会孵化,社区也较为活跃,后期的发展空间较为可观。
和传统的API网关相比,APISIX 和 Kong 一样也是通过插件的形式来提供负载均衡、日记记录、身份鉴权、流量控制等功能。
https://apisix.apache.org/zh/docs/apisix/installation-guide/#%E5%AE%89%E8%A3%85-etcd
https://apisix.apache.org/zh/docs/apisix/installation-guide/
https://www.bookstack.cn/read/apisix-3.0-zh/3a3ad75e1267bfce.md
http://www.lxiaoyu.com/p/77104
本文安装环境为centos7 rpm安装方式 apisix2.5
rpm -ivh epel-release-latest-7.noarch.rpm
yum install yum-utils
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
yum install -y openresty
tar -xvf etcd-v3.4.15-linux-amd64.tar.gz &&
cd etcd-v3.4.15-linux-amd64 &&
sudo cp -a etcd etcdctl /usr/bin/
启动etcd etcd &
端口2379
yum install -y https://github.com/apache/apisix/releases/download/2.5/apisix-2.5-0.x86_64.rpm
apisix version
apisix start
apisix 是基于nginx,所以此处启动后会启动nginx进程,当执行apisix stop
时,nginx进程不会被杀死,此时重启后会出现一些问题,最好停止后直接杀死nginx进程后重启 kill -9 $(ps aux | grep 'nginx' | grep -v grep | tr -s ' '| cut -d ' ' -f 2)
配置:设置允许访问ip
cd /usr/local/apisix/conf
vi config-default.yaml
3.1. 安装
yum install -y https://github.com/apache/apisix-dashboard/releases/download/v2.6/apisix-dashboard-2.6-0.x86_64.rpm
3.2 配置conf
cd /usr/local/apisix/dashboard/conf
vi conf.yaml
释掉allow_list
3.3 启动验证
启动nohup manager-api -p /usr/local/apisix/dashboard/ &
在浏览器输入http://hostip:9000,默认登录用户密码均为admin
3.4 启动脚本(未测试)
if [[ $1 == "start" ]];then
nohup manager-api -p /usr/local/apisix/dashboard/ >> /tmp/apisix-dashboard.log 2>&1 &
systemctl start etcd
elif [[ $1 == "kill" ]];then
systemctl stop etcd
ps -ef | grep "/usr/local/apisix/dashboard/" | grep manager-api | awk '{print $2}' | xargs kill -9
ps -ef | egrep "dashboard|etcd"
fi
ps -eo etime,pid,command | egrep "dashboard|etcd" | grep -v grep
以nacos和minio配置为例,直接用dashboard配置
可以理解为nginx的upstream
这里配置一下nacos和user服务(省略),核心就是ip 端口
核心在路径和请求改写
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。