
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
FIWARE Short Time Historic (STH) - Comet 是 FIWARE 生态系统的核心组件,负责管理(存储和检索)来自 https://github.com/telefonicaid/fiware-orion 实例的历史上下文信息,包括原始数据和聚合时间序列数据。该组件通过标准化的 NGSI v1 接口与 Orion Context Broker 及第三方系统通信,支持上下文数据(即实体属性值)随时间变化的追踪与分析。
本项目属于 https://www.fiware.org/ 核心上下文管理章节,更多信息可参考 https://github.com/Fiware/catalogue/tree/master/core%E3%80%82
| :books: https://fiware-sth-comet.readthedocs.io | :whale: https://registry.hub.docker.com/r/telefonicaiot/fiware-sth-comet | https://quay.io/repository/fiware/sth-comet |
|---|
适用于需要追踪和分析上下文数据随时间变化的 IoT 场景,例如:
需与 Orion Context Broker 配合使用,作为上下文数据的历史存储与分析模块。
可从 Docker Hub 或 Quay.io 获取镜像:
bash# Docker Hub docker pull docker.xuanyuan.run/telefonicaid/fiware-sth-comet # Quay.io docker pull ***-quay.xuanyuan.run/fiware/sth-comet
基本启动命令
bashdocker run -d --name sth-comet \ -p 8666:8666 \ # STH 服务端口 -e STH_MONGO_URI=mongodb://<mongodb-host>:27017 \ # MongoDB 连接地址 -e STH_ORION_URL=http://<orion-host>:1026 \ # Orion Context Broker 地址 -e STH_SERVICE=default \ # FIWARE 服务名(与 Orion 对应) -e STH_SERVICEPATH=/ \ # FIWARE 服务路径(与 Orion 对应) telefonicaid/fiware-sth-comet
Docker Compose 示例
yamlversion: '3' services: mongodb: image: docker.xuanyuan.run/mongo:4.4 ports: - "27017:27017" volumes: - mongodb_data:/data/db orion: image: docker.xuanyuan.run/fiware/orion ports: - "1026:1026" depends_on: - mongodb environment: - ORION_MONGO_URI=mongodb://mongodb:27017/orion sth-comet: image: docker.xuanyuan.run/telefonicaid/fiware-sth-comet ports: - "8666:8666" depends_on: - mongodb - orion environment: - STH_MONGO_URI=mongodb://mongodb:27017 - STH_ORION_URL=http://orion:1026 - STH_SERVICE=default - STH_SERVICEPATH=/ - STH_LOG_LEVEL=info # 日志级别:debug/info/warn/error volumes: mongodb_data:
常用环境变量配置:
| 环境变量 | 描述 | 默认值 |
|---|---|---|
STH_PORT | STH 服务监听端口 | 8666 |
STH_MONGO_URI | MongoDB 连接 URI | mongodb://localhost:27017 |
STH_ORION_URL | Orion Context Broker 基础 URL | http://localhost:1026 |
STH_SERVICE | FIWARE 服务名(与 Orion 一致) | default |
STH_SERVICEPATH | FIWARE 服务路径(与 Orion 一致) | / |
STH_AGGREGATION_PERIOD | 聚合周期(如:month,day,hour,minute) | minute,hour,day,month |
STH_LOG_LEVEL | 日志级别 | info |
STH 提供以下核心 API 端点:
接收 Orion 发送的上下文变更通知,存储原始及聚合数据:
POST /STH/v1/contextEntities/type/<entityType>/id/<entityId>/attributes/<attributeName>查询实体属性的历史原始值:
GET /STH/v1/contextEntities/type/<entityType>/id/<entityId>/attributes/<attributeName>?lastN=<num>bashcurl "http://sth-comet:8666/STH/v1/contextEntities/type/Device/id/Device1/attributes/temperature?lastN=10"
查询实体属性的聚合统计数据:
GET /STH/v1/contextEntities/type/<entityType>/id/<entityId>/attributes/<attributeName>?aggrMethod=<method>&dateFrom=<date>&dateTo=<date>&period=<period>bashcurl "http://sth-comet:8666/STH/v1/contextEntities/type/Device/id/Device1/attributes/temperature?aggrMethod=avg&dateFrom=2023-01-01T00:00:00Z&dateTo=2023-01-31T23:59:59Z&period=day"
删除实体或属性的历史数据:
DELETE /STH/v1/contextEntities/type/<entityType>/id/<entityId>/attributes/<attributeName>bashcurl -X DELETE "http://sth-comet:8666/STH/v1/contextEntities/type/Device/id/Device1/attributes/temperature"
为提升查询性能,建议为 MongoDB 集合创建以下索引(详细可参考 https://fiware-sth-comet.readthedocs.io/en/latest/manuals/db_indexes.html%EF%BC%89%EF%BC%9A
javascript// 原始数据集合索引 db.sth_<service>_<servicepath>_raw.createIndex({ "entityId": 1, "entityType": 1, "attrName": 1, "recvTime": -1 }) // 聚合数据集合索引 db.sth_<service>_<servicepath>_aggr_<period>.createIndex({ "entityId": 1, "entityType": 1, "attrName": 1, "timeInstant": -1 })
STH_LOG_LEVEL 调整详细程度。fiware-sth-comet 提问。sth-comet。STH-Comet 基于 GNU Affero General Public License (AGPL) v3.0 许可发布。详细许可条款见 https://github.com/telefonicaid/fiware-sth-comet/blob/master/LICENSE%E3%80%82
许可说明:仅修改源代码的衍生作品需遵循 AGPL v3.0 许可;仅使用(未修改)本组件的软件无需开源,也无需采用相同许可。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务