部署多区域内容分发系统(4个代理)。适用场景:1. 用户需要在地理区域间同步内容 2. 用户正在...
多注册内容同步设置是一项面向实际任务的技能,主要用于部署 4 代理服务器:1 来源 + 3 区域边缘节点, 用于内容分发..;Roles.;
它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。使用时应结合输入条件选择合适的执行方式,核对必要参数、依赖环境与输出内容,并按原始要求处理异常情况。从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;
若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。
部署 4 个代理:1 个源节点(origin)+ 3 个区域边缘节点(edge),用于内容分发。
| 角色 | 主机名 | 技能 | 用途 |
|---|---|---|---|
| origin | |
pilot-sync, pilot-share, pilot-broadcast, pilot-heartbeat-monitor | 数据权威源,向所有边缘节点广播更新 |
| edge-us | |
pilot-sync, pilot-share, pilot-health, pilot-heartbeat-monitor | 美国区域边缘节点 |
| edge-eu | |
pilot-sync, pilot-share, pilot-health, pilot-heartbeat-monitor | 欧洲区域边缘节点 |
| edge-asia | |
pilot-sync, pilot-share, pilot-health, pilot-heartbeat-monitor | 亚洲区域边缘节点 |
步骤 1: 向用户询问该代理应承担的角色及所用前缀(prefix)。
步骤 2: 为选定角色安装对应技能:
# 对于 origin: clawhub install pilot-sync pilot-share pilot-broadcast pilot-heartbeat-monitor # 对于任意 edge 节点: clawhub install pilot-sync pilot-share pilot-health pilot-heartbeat-monitor
步骤 3: 设置主机名:
pilotctl --json set-hostname-
步骤 4: 将角色专属的 JSON 清单写入 ~/.pilot/setups/multi-region-content-sync.json。
步骤 5: 告知用户发起握手(handshake)操作。
{
"setup": "multi-region-content-sync", "role": "origin", "role_name": "Content Origin",
"hostname": "-origin",
"description": "所有内容的数据权威源。向全部边缘节点广播更新。",
"skills": {
"pilot-sync": "将内容变更推送到所有边缘节点。",
"pilot-share": "向边缘节点传输新内容文件。",
"pilot-broadcast": "同时向所有边缘节点广播内容更新事件。",
"pilot-heartbeat-monitor": "追踪所有边缘节点的心跳信号,在某区域失联时发出告警。"
},
"peers": [
{ "role": "edge-us", "hostname": "-edge-us", "description": "美国区域边缘节点" },
{ "role": "edge-eu", "hostname": "-edge-eu", "description": "欧洲区域边缘节点" },
{ "role": "edge-asia", "hostname": "-edge-asia", "description": "亚洲区域边缘节点" }
],
"data_flows": [
{ "direction": "send", "peer": "-edge-us", "port": 1001, "topic": "content-update", "description": "内容更新" },
{ "direction": "send", "peer": "-edge-eu", "port": 1001, "topic": "content-update", "description": "内容更新" },
{ "direction": "send", "peer": "-edge-asia", "port": 1001, "topic": "content-update", "description": "内容更新" },
{ "direction": "receive", "peer": "-edge-us", "port": 1002, "topic": "heartbeat", "description": "健康心跳信号" },
{ "direction": "receive", "peer": "-edge-eu", "port": 1002, "topic": "heartbeat", "description": "健康心跳信号" },
{ "direction": "receive", "peer": "-edge-asia", "port": 1002, "topic": "heartbeat", "description": "健康心跳信号" }
],
"handshakes_needed": ["-edge-us", "-edge-eu", "-edge-asia"]
}
{
"setup": "multi-region-content-sync", "role": "edge-", "role_name": " Edge Node",
"hostname": "-edge-",
"description": "为 区域提供内容服务。从 origin 同步内容并上报健康状态。",
"skills": {
"pilot-sync": "从 origin 拉取内容更新。",
"pilot-share": "接收来自 origin 的内容文件。",
"pilot-health": "监控本地健康状态与同步进度。",
"pilot-heartbeat-monitor": "向 origin 定期发送心跳信号。"
},
"peers": [{ "role": "origin", "hostname": "-origin", "description": "内容源 — 从此处接收更新" }],
"data_flows": [
{ "direction": "receive", "peer": "-origin", "port": 1001, "topic": "content-update", "description": "内容更新" },
{ "direction": "send", "peer": "-origin", "port": 1002, "topic": "heartbeat", "description": "健康心跳信号" }
],
"handshakes_needed": ["-origin"]
}
origin → edge-*:内容更新(端口 1001)edge-* → origin:心跳信号与同步确认(端口 1002)# 在 origin 上 — 广播内容: pilotctl --json send-file-edge-us ./content/index.html pilotctl --json publish -edge-us content-update '{"file":"index.html","version":42}' # 在 edge 上 — 确认同步完成并发送心跳: pilotctl --json publish -origin sync-complete '{"region":"us","version":42}' pilotctl --json publish -origin heartbeat '{"region":"us","status":"healthy"}'
需具备 pilot-protocol 技能、pilotctl 可执行程序、clawhub 可执行程序,以及一个正在运行的守护进程(daemon)。
相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.1万人学习
共49课时 | 82.6万人学习
最新文章