Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add table query api in ceresmeta #105

Merged
merged 1 commit into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 38 additions & 17 deletions docs/src/cn/operation/ceresmeta.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,33 @@

## 运维接口

注意: 如下接口在实际使用时需要将 {CeresMetaAddr} 替换为 CeresMeta 的真实地址,如果部署在本地,可以直接替换为 `127.0.0.1`
注意: 如下接口在实际使用时需要将 127.0.0.1 替换为 CeresMeta 的真实地址。

- 查询表元信息
当 tableNames 不为空的时候,使用 tableNames 进行查询。
当 tableNames 为空的时候,使用 ids 进行查询。使用 ids 查询的时候,schemaName 不生效。

```
curl --location 'http://127.0.0.1:8080/api/v1/table/query' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
"schemaName":"public",
"names":["demo1", "__demo1_0"],
}'

curl --location 'http://127.0.0.1:8080/api/v1/table/query' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
"ids":[0, 1]
}'
```

- 查询表的路由信息

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/route' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/route' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
Expand All @@ -21,29 +42,29 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/route' \
- 查询节点对应的 Shard 信息

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/getNodeShards' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/getNodeShards' \
--header 'Content-Type: application/json' \
-d '{
"ClusterName":"defaultCluster"
}'
```

- 查询 Shard 对应的表信息
如果 shardIDs 为空时,查询所有 shard 上表信息。

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/getShardTables' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/getShardTables' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
"nodeName":"127.0.0.1:8831",
"shardIDs": [1,2]
}'
```

- 删除指定表的元数据

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/dropTable' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/dropTable' \
--header 'Content-Type: application/json' \
-d '{
"clusterName": "defaultCluster",
Expand All @@ -55,7 +76,7 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/dropTable' \
- Shard 切主

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/transferLeader' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/transferLeader' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
Expand All @@ -68,7 +89,7 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/transferLeade
- Shard 分裂

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/split' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/split' \
--header 'Content-Type: application/json' \
-d '{
"clusterName" : "defaultCluster",
Expand All @@ -82,7 +103,7 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/split' \
- 创建 CeresDB 集群

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/clusters' \
curl --location 'http://127.0.0.1:8080/api/v1/clusters' \
--header 'Content-Type: application/json' \
--data '{
"name":"testCluster",
Expand All @@ -96,7 +117,7 @@ curl --location 'http://{CeresMetaAddr}:8080/api/v1/clusters' \
- 更新 CeresDB 集群

```
curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/clusters/{NewClusterName}' \
curl --location --request PUT 'http://127.0.0.1:8080/api/v1/clusters/{NewClusterName}' \
--header 'Content-Type: application/json' \
--data '{
"nodeCount":28,
Expand All @@ -109,13 +130,13 @@ curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/clusters/{NewC
- 列出 CeresDB 集群

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/clusters'
curl --location 'http://127.0.0.1:8080/api/v1/clusters'
```

- 更新限流器

```
curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/flowLimiter' \
curl --location --request PUT 'http://127.0.0.1:8080/api/v1/flowLimiter' \
--header 'Content-Type: application/json' \
--data '{
"limit":1000,
Expand All @@ -127,19 +148,19 @@ curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/flowLimiter' \
- 查询限流器信息

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/flowLimiter'
curl --location 'http://127.0.0.1:8080/api/v1/flowLimiter'
```

- CeresMeta 列出节点

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/member'
curl --location 'http://127.0.0.1:8080/api/v1/etcd/member'
```

- CeresMeta 节点切主

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/moveLeader' \
curl --location 'http://127.0.0.1:8080/api/v1/etcd/moveLeader' \
--header 'Content-Type: application/json' \
--data '{
"memberName":"meta1"
Expand All @@ -149,7 +170,7 @@ curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/moveLeader' \
- CeresMeta 节点扩容

```
curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/etcd/member' \
curl --location --request PUT 'http://127.0.0.1:8080/api/v1/etcd/member' \
--header 'Content-Type: application/json' \
--data '{
"memberAddrs":["http://127.0.0.1:42380"]
Expand All @@ -159,7 +180,7 @@ curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/etcd/member' \
- CeresMeta 替换节点

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/member' \
curl --location 'http://127.0.0.1:8080/api/v1/etcd/member' \
--header 'Content-Type: application/json' \
--data '{
"oldMemberName":"meta0",
Expand Down
55 changes: 38 additions & 17 deletions docs/src/en/operation/ceresmeta.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,33 @@ The Operations for CeresDB cluster mode, it can only be used when CeresMeta is d

## Operation Interface

You need to replace {CeresMetaAddr} with the actual project path, if you are start CeresMeta in localhost, You can directly replace it with `127.0.0.1`.
You need to replace 127.0.0.1 with the actual project path.

- Query table
When tableNames is not empty, use tableNames for query.
When tableNames is empty, ids are used for query. When querying with ids, schemaName is useless.

```
curl --location 'http://127.0.0.1:8080/api/v1/table/query' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
"schemaName":"public",
"names":["demo1", "__demo1_0"],
}'

curl --location 'http://127.0.0.1:8080/api/v1/table/query' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
"ids":[0, 1]
}'
```

- Query the route of table

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/route' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/route' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
Expand All @@ -21,29 +42,29 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/route' \
- Query the mapping of shard and node

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/getNodeShards' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/getNodeShards' \
--header 'Content-Type: application/json' \
-d '{
"ClusterName":"defaultCluster"
}'
```

- Query the mapping of table and shard
If ShardIDs in the request is empty, query with all shardIDs in the cluster.

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/getShardTables' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/getShardTables' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
"nodeName":"127.0.0.1:8831",
"shardIDs": [1,2]
}'
```

- Drop table

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/dropTable' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/dropTable' \
--header 'Content-Type: application/json' \
-d '{
"clusterName": "defaultCluster",
Expand All @@ -55,7 +76,7 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/dropTable' \
- Transfer leader shard

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/transferLeader' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/transferLeader' \
--header 'Content-Type: application/json' \
-d '{
"clusterName":"defaultCluster",
Expand All @@ -68,7 +89,7 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/transferLeade
- Split shard

```
curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/split' \
curl --location --request POST 'http://127.0.0.1:8080/api/v1/split' \
--header 'Content-Type: application/json' \
-d '{
"clusterName" : "defaultCluster",
Expand All @@ -82,7 +103,7 @@ curl --location --request POST 'http://{CeresMetaAddr}:8080/api/v1/split' \
- Create cluster

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/clusters' \
curl --location 'http://127.0.0.1:8080/api/v1/clusters' \
--header 'Content-Type: application/json' \
--data '{
"name":"testCluster",
Expand All @@ -96,7 +117,7 @@ curl --location 'http://{CeresMetaAddr}:8080/api/v1/clusters' \
- Update cluster

```
curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/clusters/{NewClusterName}' \
curl --location --request PUT 'http://127.0.0.1:8080/api/v1/clusters/{NewClusterName}' \
--header 'Content-Type: application/json' \
--data '{
"nodeCount":28,
Expand All @@ -109,13 +130,13 @@ curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/clusters/{NewC
- List clusters

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/clusters'
curl --location 'http://127.0.0.1:8080/api/v1/clusters'
```

- Update flow limiter

```
curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/flowLimiter' \
curl --location --request PUT 'http://127.0.0.1:8080/api/v1/flowLimiter' \
--header 'Content-Type: application/json' \
--data '{
"limit":1000,
Expand All @@ -127,19 +148,19 @@ curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/flowLimiter' \
- Query information of flow limiter

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/flowLimiter'
curl --location 'http://127.0.0.1:8080/api/v1/flowLimiter'
```

- List nodes of CeresMeta cluster

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/member'
curl --location 'http://127.0.0.1:8080/api/v1/etcd/member'
```

- Move leader of CeresMeta cluster

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/moveLeader' \
curl --location 'http://127.0.0.1:8080/api/v1/etcd/moveLeader' \
--header 'Content-Type: application/json' \
--data '{
"memberName":"meta1"
Expand All @@ -149,7 +170,7 @@ curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/moveLeader' \
- Add node of CeresMeta cluster

```
curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/etcd/member' \
curl --location --request PUT 'http://127.0.0.1:8080/api/v1/etcd/member' \
--header 'Content-Type: application/json' \
--data '{
"memberAddrs":["http://127.0.0.1:42380"]
Expand All @@ -159,7 +180,7 @@ curl --location --request PUT 'http://{CeresMetaAddr}:8080/api/v1/etcd/member' \
- Replace node of CeresMeta cluster

```
curl --location 'http://{CeresMetaAddr}:8080/api/v1/etcd/member' \
curl --location 'http://127.0.0.1:8080/api/v1/etcd/member' \
--header 'Content-Type: application/json' \
--data '{
"oldMemberName":"meta0",
Expand Down