Within Cloudflare, pools represent your endpoints and how they are organized. As such, a pool can be a group of several endpoints, or you could also have only one endpoint (an origin server, for example) per pool.
If you are familiar with DNS terminology, think of a pool as a “record set,” except Cloudflare only returns addresses that are considered healthy. You can attach health monitors to individual pools for customized monitoring. A pool can have either a single monitor or a monitor group attached — but not both.
有关池的更多背景信息,请参阅池。
在单个池内,每个端点必须唯一。只要端点通过端口或虚拟网络区分,端点可以共享相同的 IP 地址——这是跨不同内部网络在同一 IP 上可达的私有端点的常见模式。
您可以在负载均衡器工作流中或 Pools(池) 选项卡内创建 pool:
-
前往 Load Balancing(负载均衡)。
-
选择 Pools(池) 选项卡,然后选择 Create pool(创建池)。
-
为您的 pool 输入以下信息:
- 名称(必须唯一)
- 描述,提供更多名称详情
- Endpoint Steering(端点流量导向) 选项,影响 pool 如何将流量路由到每个 endpoint
-
对于每个 endpoint,输入以下信息:
- 名称(必须唯一)
- endpoint 地址或关联主机名
- (可选)Virtual Network。当 endpoint 具有私有 IP 地址时必填。
- Weight
- (可选)点击 Add host header(添加主机标头) 设置主机名
- (可选)流量将送达的目标端口。
-
对 pool 中的其他 endpoint 重复此过程。
-
(可选)在 pool 上设置 Proximity Steering 的坐标。
-
在 pool 上更新以下信息:
- Health Threshold(健康阈值):
Health Threshold 是 pool 整体被视为健康并根据负载均衡器中的 pool 顺序接收流量所需的健康 endpoint 数量。增加此数值会使 pool 更可靠,但也更容易变为不健康。
- Monitor:附加 monitor
- Health Monitor Regions(健康监视器区域):选择是否从多个位置检查 pool 健康状态,这提高准确性但可能导致对 endpoint 的探测流量
- Pool Notifications(池通知):您可以设置新警报——并查看现有警报——以便在 pool 启用或禁用时,或 pool/endpoint 的健康状态发生变化时收到通知。
- Health Threshold(健康阈值):
-
完成后,选择 Save(保存)。
有关完整属性列表,请参阅 Create Pool。如需 API 身份验证帮助,请参阅 Cloudflare API 文档。
Required API token permissions
At least one of the following token permissions is required:Load Balancing: Monitors and Pools Write
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/load_balancers/pools" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"description": "Primary data center - Provider XYZ",
"name": "primary-dc-1",
"enabled": false,
"load_shedding": {
"default_percent": 0,
"default_policy": "random",
"session_percent": 0,
"session_policy": "hash"
},
"minimum_origins": 2,
"monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
"check_regions": [
"WEU",
"ENAM"
],
"origins": [
{
"name": "app-server-1",
"address": "0.0.0.0",
"enabled": true,
"weight": 0.56,
"header": {
"Host": [
"example.com"
]
}
}
],
"origin_steering": {
"policy": "random"
},
"notification_filter": {
"origin": {
"disable": false,
"healthy": null
},
"pool": {
"disable": false,
"healthy": null
}
}
}'响应包含新 pool 的完整定义。
{
"success": true,
"errors": [],
"messages": [],
"result": {
"id": "17b5962d775c646f3f9725cbc7a53df4",
"created_on": "2021-01-01T05:20:00.12345Z",
"modified_on": "2021-01-01T05:20:00.12345Z",
"description": "Primary data center - Provider XYZ",
"name": "primary-dc-1",
"enabled": false,
"load_shedding": {
"default_percent": 0,
"default_policy": "random",
"session_percent": 0,
"session_policy": "hash"
},
"minimum_origins": 2,
"monitor": "f1aba936b94213e5b8dca0c0dbf1f9cc",
"check_regions": [
"WEU",
"ENAM"
],
"origins": [
{
"name": "app-server-1",
"address": "0.0.0.0",
"enabled": true,
"weight": 0.56,
"header": {
"Host": [
"example.com"
]
}
}
],
"origin_steering": {
"policy": "random"
},
"notification_filter": {
"origin": {
"disable": false,
"healthy": null
},
"pool": {
"disable": false,
"healthy": null
}
}
}
}创建 pool 后,您还需要创建新通知,并指定以下参数:
"alert_type": "load_balancing_health_alert",
"filters": {
"pool_id": <<ARRAY_OF_INCLUDED_POOL_IDS>>,
"new_health": <<ARRAY_OF_STATUS_TRIGGERS>> ["Unhealthy", "Healthy"],
"event_source": <<ARRAY_OF_OBJECTS_WATCHED>> ["pool", "origin"]
}您无法删除负载均衡器正在使用的池。这包括地理导向区域池以及回退池。
如果尝试删除池时出现错误,请考虑错误中列出的主机名,并编辑相应的负载均衡器,确保移除对该池的所有引用。
要在仪表板中删除池:
- 前往 Load Balancing(负载均衡)。
- 选择 Pools(池) 选项卡。
- 在特定池上,选择 Delete(删除)。
要使用 API 删除池,请发送 DELETE 请求。
您可以配置告警,以在池状态发生变化时接收通知。
Pool Enablement
Who is it for?Customers who want to be warned about status changes (enabled/disabled) in their pools.
Other options / filtersAvailable filters include:
- You can search for and add pools from your list of pools. If no pools are selected, the alert will apply to all pools in the account.
- You can also choose the trigger that fires the notification when the Load Balancing pool is enabled, disabled, and either enabled or disabled.
Purchase of Load Balancing.
What should you do if you receive one?No action is needed.
Load Balancing Health Alert
Who is it for?Customers who want to be warned about changes in health status in their pools or origins.
Other options / filtersAvailable filters include:
- You can search for and add pools from your list of pools, as well as Include future pools (if all pools are selected).
- You can choose the trigger that fires the notification when the health status becomes unhealthy, healthy, or either unhealthy or healthy
- You can choose the trigger that fires the notification when the event source health status changes in pool, origin, or either pool or origin.
Purchase of Load Balancing.
What should you do if you receive one?Evaluate load balancing analytics to review changes in health status over time.
有关如何设置警报的更多信息,请参阅 Cloudflare Notifications。