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

安装 API7 企业版

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

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

提示

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

对于生产环境部署,PostgreSQL 是主要且推荐的存储后端。API7 企业版还支持以下数据库和版本:

  • PostgreSQL:12.x–18.x
  • MySQL:5.7、8.x
  • Microsoft SQL Server:2019、2022

除本页介绍的容器化快速启动方式外,API7 企业版还支持 Kubernetes 和 RPM 部署。有关完整的兼容性信息和安装方式,请参阅支持的版本和互操作性及在本地环境安装 API7 网关。

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

前置条件​

  • 安装 Docker 和 Docker Compose。在 Linux 上,推荐使用 3.10.0-927 或更高版本的内核;已知 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

有关可用命令和配置的更多详细信息,请参阅ADC 参考。

激活 API7 企业版​

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

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

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

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

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

按照从控制台获取令牌中的步骤,在 API7 网关控制台生成令牌。

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

.env
ADC_BACKEND=api7ee # 指定后端为 API7 企业版
ADC_TOKEN=a7ee-YVDPvh6CXxMuz5iM... # 替换为你的令牌
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 上部署 API7 企业版和设置 Ingress Controller 和网关。
  2. 按照发布你的第一个 API中的步骤发布 API,进一步了解 API7 企业版的使用方法。
  3. 按照部署高可用环境部署 API7 企业版。
  4. 联系 API7 专家申请试用,开始在生产环境中使用 API7 企业版。