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

安装 API7 企业版

本教程将引导你使用快速启动脚本在 Docker 中安装 API7 企业版。

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

提示

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

对于生产环境的部署,API7 企业版也支持其他数据库。经过测试并支持的数据库及其版本如下:

  • PostgreSQL: 15, 16, 17, 18
  • MySQL: 5.7
  • OceanBase: 4.2.2
  • Microsoft SQL Server: 2022

部署仅支持通过基于容器的方法(如 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 声明式命令行(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 企业版控制台并生成令牌。

创建一个包含以下变量的 .env 文件:

.env
ADC_BACKEND=api7ee # specify the backend is API7 Enterprise
ADC_TOKEN=a7ee-YVDPvh6CXxMuz5iM... # replace with your token
ADC_SERVER=https://localhost:7443 # update server address if you are not running API7 Enterprise locally

或者,你也可以在命令行参数中指定这些值。有关更多信息,请参阅 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 企业版。