跳到主要内容
版本:3.8.x

安装 API7 企业版

本教程介绍如何使用快速入门脚本在 Docker 中安装 API7 企业版。

安装将包括 API7 企业版组件(数据面、控制面和控制台),以及分别用于配置管理和监控的外部组件(PostgreSQL 和 Prometheus)。

提示

本指南提供用于概念验证(PoC)测试的容器化一体式解决方案,其中包含 PostgreSQL 和 Prometheus。你无需手动设置数据库和监控,可简化 PoC 流程。

对于生产部署,API7 企业版还支持使用 MySQL 和 OceanBase 替代 PostgreSQL。仅支持通过 Docker 等容器方式或 Kubernetes 等容器编排平台部署,不支持使用 deb 或 rpm 包安装。

请联系 API7 专家,获取高可用和可扩展性解决方案。

前提条件​

  • 安装 Docker 和 Docker Compose。建议使用 Docker 3.10.0-927 或更高版本。已知 Docker 3.10.0-327 或更早版本不兼容。
  • 安装 cURL。
  • 获取 30 天免费试用许可证。
  • 操作系统:建议使用 Linux CentOS 7.6 或更高版本。已知 Linux CentOS 7.2 或更早版本不兼容。

安装 API7 企业版​

curl -sL "https://run.api7.ai/api7/quickstart" | bash

你应该看到类似以下内容的响应:

✔ Container api7-ee-postgresql
✔ Container api7-ee-prometheus
✔ Container api7-ee-api7-ee-dashboard
✔ Container api7-ee-api7-ee-dp-manager
✔ Container api7-ee-api7-ee-gateway
...
✔ API7-EE is ready!

API7-EE Listening: Dashboard(https://192.168.2.102:7443), Control Plane Address(http://192.168.2.102:7900, https://192.168.2.102:7943), Gateway(http://192.168.2.102:9080, https://192.168.2.102:9443)

If you want to access Dashboard with HTTP Endpoint(:7080), you can turn server.listen.disable to false in dashboard_conf/conf.yaml, then restart dashboard container

(可选)安装 ADC​

你还可以安装 API Declarative CLI(ADC),以声明式方式管理 API7 企业版。

curl -sL "https://run.api7.ai/adc/install" | bash

运行以下命令验证安装:

adc help

你应该看到以下响应:

Usage: adc [options] [command]

Options:
-V, --version output the version number
-h, --help display help for command

Commands:
ping [options] Verify connectivity with backend
dump [options] Dump configurations from the backend
diff [options] Show the difference between local and backend configurations
sync [options] Sync local configurations to backend
convert [options] Convert other API spec to ADC configurations
lint [options] Check provided configuration files, local execution only, ensuring inputs meet ADC requirements
help [command] display help for command

请参阅命令参考,了解可用命令和配置的更多信息。

激活 API7 企业版​

  1. 访问 API7 企业版控制台 https://{your_inet_ip_addr}:7443,使用默认用户名 admin 和密码 admin 登录(建议首次登录后修改默认密码)。
信息

你也可以通过 https://localhost:7443/login 访问控制台。但后续在控制台生成的部署脚本会默认使用 localhost 作为 IP 地址,这可能导致连接问题,例如在 Kubernetes 上部署 API7 网关和 Ingress Controller时。

  1. 选择要上传的许可证,然后点击上传以激活 API7 企业版。

(可选)使用 ADC 连接 API7 企业版​

在使用 ADC 将配置同步到 API7 企业版之前,首先确保 ADC 客户端能够完成身份认证并与 API7 企业版通信。你需要在 .env 文件中或通过命令行参数配置几个变量。

进入 API7 企业版控制台并生成 Token。

创建 .env 文件,包含以下变量:

.env
ADC_BACKEND=api7ee # 指定后端为 API7 企业版
ADC_TOKEN=a7ee-YVDPvh6CXxMuz5iM... # 替换为你的 Token
ADC_SERVER=https://localhost:7443 # 如果未在本地运行 API7 企业版,请更新服务器地址

你也可以通过命令行参数指定这些值。请参阅 ADC 环境变量了解更多信息。

运行以下命令验证连通性:

adc ping

你应该看到以下响应:

Connected to the "api7ee" backend successfully!

停止 API7 企业版​

完成 API7 企业版测试后,可以在 api7-ee 目录下使用以下命令停止 API7 企业版:

bash run.sh stop

后续步骤​

  1. 如果希望在 Kubernetes 上部署 API7 网关并使用 Ingress Controller,请参阅在 Kubernetes 上部署网关和 Ingress Controller。
  2. 按照入门教程,进一步了解如何使用 API7 企业版。
  3. 以高可用配置部署 API7 企业版。
  4. 与 API7 专家预约会议,开始在生产环境中使用 API7 企业版。