apisix布署
时间: 2025-05-28 14:42:56 浏览: 21
### APIsix 部署指南
#### 1. 环境准备
在部署 Apache APISIX 前,需确保环境满足其运行需求。APISIX 使用 etcd 存储配置数据,因此需要先安装并启动 etcd[^4]。
通过浏览器访问 `http://<etcd-server-ip>:2379/version` 来验证 etcd 是否正常工作。如果返回 JSON 数据 `{ "etcdserver": "3.5.11", "etcdcluster": "3.5.0" }` 则表示成功[^4]。
#### 2. Docker 部署方式
对于快速搭建测试环境,推荐使用官方提供的 Docker 镜像来部署 APISIX。Docker 提供了一种简单的方式,在容器化环境中运行 APISIX 和所需依赖项[^2]。
以下是基于 Docker 的部署命令:
```bash
docker pull apache/apisix:latest
docker run -d --name apisix \
-e ETCD_HOST=etcd \
-e ETCD_PORT=2379 \
-p 9080:9080 \
-p 9443:9443 \
apache/apisix:latest
```
此脚本会拉取最新版本的 APISIX 镜像,并将其绑定到主机端口 9080 (HTTP) 和 9443 (HTTPS)[^2]。
#### 3. 手动部署流程
手动部署适合生产环境或更复杂的定制化场景。以下为具体步骤:
- **创建目录**
创建一个新的工作目录用于存储 APISIX 及相关文件。
```bash
mkdir apisix-3.7 && cd apisix-3.7
git init
```
- **克隆仓库**
下载 APISIX 部署库至当前路径。
```bash
git clone https://github.com/yuluo-yx/apisix-deploy .
```
- **修改配置**
编辑默认配置文件以适配实际网络条件。
```yaml
deployment:
role: traditional
role_traditional:
config_provider: etcd
etcd:
host:
- http://127.0.0.1:2379
prefix: "/apisix"
```
上述 YAML 文件定义了如何连接到远程 etcd 实例以及前缀设置[^3]。
- **启动服务**
启动 Nginx 进程加载 APISIX 插件集。
```bash
make run
```
#### 4. 安装 Dashboard 控制台
为了方便管理路由规则、插件启用状态等功能模块,可以额外安装 APISIX Dashboard GUI 工具[^4]。
执行以下指令完成初始化操作:
```bash
sudo mkdir -p /usr/apisix-dashboard/conf
sudo cp ./conf/conf.yaml.example /usr/apisix-dashboard/conf/conf.yaml
npm install
npm start
```
最后确认 Web 页面能够正常展示即可。
---
阅读全文
相关推荐
















