You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GridDB WebAPI访问已存在分区容器时返回‘Container not existed’错误

GridDB WebAPI 返回"Container not existed"但分区容器实际存在的问题解决

问题描述

GridDB WebAPI无法与分区容器交互,即使容器存在且可通过gs_sh正常访问,仍返回"Container not existed"错误。

环境信息

OS: Ubuntu 22.04
GridDB Server: 5.0.0-39331 CE
WebAPI: 2.2.0

容器配置

gs[public]> showcontainer RAWLOG_agent_tests
Database    : public
Name        : RAWLOG_agent_tests
Type        : COLLECTION
Partition ID: 78
DataAffinity: -
Partitioned : true
Partition Type           : INTERVAL
Partition Column         : ts
Partition Interval Value : 30
Partition Interval Unit  : DAY
Expiration Type      : PARTITION
Expiration Time      : 30
Expiration Time Unit : DAY

Columns:
No  Name                  Type            CSTR  RowKey
------------------------------------------------------------------------------
 0  ts                    TIMESTAMP       NN    
 1  hostname              STRING                
 2  logtype               STRING                
 3  value                 STRING                
 4  path                  STRING

WebAPI请求与响应

$ curl -X POST --basic -u admin:admin \
  -H "Content-type: application/json" \
  -d '{"limit":2}' \
  'http://localhost:8080/griddb/v2/myCluster/dbs/public/containers/RAWLOG_agent_tests/rows'

响应:

{"version":"v2","errorCode":0,"errorMessage":"Container not existed"}

可能的解决方案

1. 验证集群名称正确性

请求URL中的myCluster需要与GridDB实际集群名称匹配。默认集群名称为defaultCluster,可通过以下方式确认:

  • 查看GridDB配置文件gs_cluster.json中的clusterName字段
  • 执行gs_stat -u admin/admin命令查看集群信息

如果集群名称不符,修改URL中的集群名称部分,例如改为defaultCluster:

'http://localhost:8080/griddb/v2/defaultCluster/dbs/public/containers/RAWLOG_agent_tests/rows'

2. 检查WebAPI对分区容器的访问支持

GridDB WebAPI 2.2.0版本对区间分区容器的访问需要注意:

  • 若容器设置了分区过期,需确保访问的分区未被自动清理
  • 尝试在请求中指定分区范围,例如通过filter参数限定ts的时间范围,匹配现有分区的时间区间:
$ curl -X POST --basic -u admin:admin \
  -H "Content-type: application/json" \
  -d '{"limit":2, "filter":"ts >= TIMESTAMP('\''2024-01-01T00:00:00Z'\'')"}' \
  'http://localhost:8080/griddb/v2/myCluster/dbs/public/containers/RAWLOG_agent_tests/rows'

3. 确认WebAPI配置的集群连接参数

检查WebAPI配置文件griddb-webapi.conf中的以下参数:

  • clusterName:需与GridDB集群名称一致
  • notificationMember:需正确配置GridDB节点的通知地址(例如127.0.0.1:10001)
  • databaseName:默认应为public,确保与请求中的数据库名匹配

修改配置后需重启WebAPI服务:

sudo systemctl restart griddb-webapi

4. 验证容器名称与权限

  • 确认容器名称大小写完全一致:GridDB容器名称区分大小写,确保请求中的RAWLOG_agent_tests与gs_sh中显示的名称完全匹配
  • 检查WebAPI用户权限:确保admin用户拥有访问public数据库及目标容器的权限,可通过gs_sh执行showuser命令验证权限配置

内容的提问来源于stack exchange,提问作者Nooruddin Lakhani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 04:42:41