安装指南
本教程介绍如何使用快速入门脚本在 Docker 中安装 API7 企业版。
安装内容包括数据面、控制面和控制台等 API7 企业版组件,以及分别用于管理配置和监控的外部组件 PostgreSQL 和 Prometheus。
本指南提供用于概念验证(PoC)测试的容器化一体式方案,其中包含 PostgreSQL 和 Prometheus。你无需手动设置数据库和监控组件,即可开展测试。
在生产环境中,API7 企业版也支持使用 MySQL 或 OceanBase 替代 PostgreSQL。部署仅支持容器方式,例如 Docker 或 Kubernetes 等容器编排平台。API7 企业版不支持通过 deb 或 rpm 软件包安装。
如需高可用和可扩展的方案,请联系 API7 专家。
前提条件
- 安装 Docker 和 Docker Compose。建议使用 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)
API7-EE Listening: Dashboard(https://26.26.26.1:7443), Control Plane Address(http://26.26.26.1:7900, https://26.26.26.1:7943), Gateway(http://26.26.26.1:9080, https://26.26.26.1: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 企业版
-
访问 API7 企业版控制台
https://{your_inet_ip_addr}:7443,使用默认用户名admin和密码admin登录。信息你也可以通过
https://localhost:7443/login访问控制台。控制台随后生成的部署脚本会默认使用localhost作为 IP 地址,这可能导致连接问题,例如在 Kubernetes 上部署 API7 网关和 Ingress Controller时。 -
选择要上传的许可证,然后点击 上传以激活 API7 企业版。
(可选)使用 ADC 连接到 API7 企业版
将配置同步到 API7 企业版之前,请确保 ADC 客户端能够通过身份验证并连接到 API7 企业版。你需要在 .env 文件或命令行参数中设置相应的变量。
在 API7 企业版控制台中生成 Token。
创建一个包含以下变量的 .env 文件。
ADC_BACKEND=api7ee # 指定 API7 企业版为后端
ADC_TOKEN=YOUR_ADC_TOKEN # 替换为你的 Token
ADC_SERVER=https://localhost:7443 # 如果 API7 企业版不在本地运行,请更新服务器地址
你也可以通过命令行参数指定这些值。详情请参阅 ADC 环境变量。
运行以下命令以验证连接。
adc ping
你应看到以下输出。
Connected to the "api7ee" backend successfully!
终止 API7 企业版
完成测试后,你可以在 api7-ee 目录下运行以下命令,停止 API7 企业版。
bash run.sh stop
后续步骤
- 如需在 Kubernetes 上部署 API7 网关并使用 Ingress Controller,请参阅在 Kubernetes 上部署网关和 Ingress Controller。
- 查看入门教程,了解如何使用 API7 企业版。
- 在高可用配置中部署 API7 企业版。
- 如需在生产环境中使用 API7 企业版,请预约与 API7 专家的会议。