
btburnett3/couchbase-index-manager提供用于管理Couchbase索引的命令行界面,可将索引同步至文件中提供的索引定义。旨在作为CI/CD流水线的一部分使用,或辅助本地开发。
shdocker run --rm -it -v ./:/definitions btburnett3/couchbase-index-manager -c couchbase://cluster -u Administrator -p password sync beer-sample /definitions
sync命令用于执行索引同步操作
shcouchbase-index-manager sync <bucketName> <path>
bucketName为待同步的桶名称,path为索引定义文件的路径。path可以是单个YAML或JSON文件,也可以是包含多个文件的目录。
shcouchbase-index-manager -c couchbase://localhost -u Administrator -p password sync beer-sample ./directory/ couchbase-index-manager -c couchbase://localhost -u Administrator -p password sync beer-sample ./directory/file.yaml couchbase-index-manager -c couchbase://localhost -u Administrator -p password sync beer-sample ./directory/file.json
定义文件可使用JSON或YAML格式编写,用于定义索引名称、索引列及其他选项。
使用YAML时,单个文件中可包含多个定义,用一行短横线分隔。
yamlname: BeersByAbv index_key: - abv condition: (`type` = 'beer') num_replica: 0 --- name: BeersByIbu index_key: - ibu condition: (`type` = 'beer') num_replica: 0 --- name: OldIndex lifecycle: drop: true
| 字段 | 是否必填 | 描述 |
|---|---|---|
| name | 是 | 索引名称 |
| index_key | 是 | 索引键数组,可为文档属性或确定性函数 |
| condition | 否 | 索引WHERE子句的条件 |
| num_replicas | 否 | 默认为0,要创建的索引副本数量 |
| lifecycle.drop | 否 | 若为true,存在该索引时将其删除 |
couchbase-index-manager需要能够识别索引何时更新。Couchbase Server会对index_key和condition进行某些规范化处理,这意味着Couchbase中的值可能与创建索引时提交的值略有不同。
因此,创建定义文件时需考虑规范化。确保定义中包含已规范化的键和条件,否则couchbase-index-manager可能在每次运行时删除并重新创建索引。
若从定义文件中移除某个索引,该索引不会被删除。这可防止不同CI/CD流程在管理不同索引时相互干扰。要删除索引,需保留定义并将lifecycle.drop设置为true。


manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务