一、APISIX相关介绍
1、安全网关
安全网关设置的目的是防止Internet或外网不安全因素蔓延到自己企业或组织的内部网 。
安全网关在应用层和网络层上面都有防火墙的身影。
其范围从协议级过滤到十分复杂的应用级过滤等。推荐了解传智播客linux云计算+运维开发课程。
API网关:整个流量总入口,能够进行集中管理和控制!
2、apisix介绍
APISIX 是一个云原生、高性能、可扩展的微服务 API 网关。
它是基于 OpenResty 和 etcd来实现,和传统 API 网关相比,APISIX 具备动态路由和插件热加载,特别适合微服务体系下的 API 管理。
APISIX 是基于云原生的微服务 API 网关,它是所有业务流量的入口,可以处理传统的南北向流量(server-client),也可以处理服务间的东西向流量(server-server),也可以当做 k8s ingress controller 来使用。
Tip:流量流向方向
在图表中,通常核心网络组件绘制在顶部(NORTH),客户端绘制在底部(SOUTH),而数据中心内的不同服务器水平(EAST-WEST)绘制。
APISIX 通过插件机制,提供动态负载平衡、身份验证、限流限速等功能,并且支持你自己开发的插件。
二、安装部署
1、安装apisix服务
提前解决依赖问题
CentOS 7
# install etcd
wget https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
cd etcd-v3.4.13-linux-amd64 && \
sudo cp -a etcd etcdctl /usr/bin/
# add OpenResty source
sudo yum install yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
# install OpenResty and some compilation tools
sudo yum install -y openresty curl git gcc openresty-openssl-devel unzip
# install LuaRocks
curl https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh -sL | bash -
# start etcd server
nohup etcd &
# 防火墙关闭
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
https://downloads.apache.org/ apache官网下载
安装apisix
https://github.com/apache/apisix/
下载源码
$ mkdir apisix-2.3
$ wget https://archive.apache.org/dist/apisix/2.3/apache-apisix-2.3-src.tgz
$ tar zxvf apache-apisix-2.3-src.tgz -C apisix-2.3
安装依赖包
$ make deps
检查版本
$ ./bin/apisix version
启动服务
$ ./bin/apisix start
开始安装dashboard
https://github.com/apache/apisix-dashboard
https://github.com/apache/apisix-dashboard/blob/master/docs/en/latest/deploy.md
web依赖安装
node安装
https://nodejs.org/en/download/
yarn 安装
https://yarnpkg.com/getting-started/install
克隆工程
git clone -b v2.4 https://github.com/apache/apisix-dashboard.git
编译
cd apisix-dashboard
make build
启动服务
cd output
./manager-api
nohup ./manager-api &
通过浏览器进行访问
http://ip:9080