[Docs](docs) Organize http documents (#16618)

1.  Organize http documents
2. Add http interface authentication for FE
3. Support https interface for FE
4. Provide authentication interface
5. Add http interface authentication for BE
6. Support https interface for BE
This commit is contained in:
yongjinhou
2023-02-24 15:17:01 +08:00
committed by GitHub
parent d562428b1d
commit 7470198df6
62 changed files with 2145 additions and 1902 deletions

View File

@ -267,6 +267,10 @@
"message": "用户权限及认证",
"description": "The label for category User Privilege and Ldap in sidebar docs"
},
"sidebar.docs.category.System Table": {
"message": "System Table",
"description": "The label for category System Table in sidebar docs"
},
"sidebar.docs.category.HTTP API": {
"message": "HTTP API",
"description": "The label for category HTTP API in sidebar docs"
@ -275,9 +279,9 @@
"message": "FE",
"description": "The label for category FE in sidebar docs"
},
"sidebar.docs.category.MANAGER": {
"message": "MANAGER",
"description": "The label for category MANAGER in sidebar docs"
"sidebar.docs.category.BE": {
"message": "BE",
"description": "The label for category BE in sidebar docs"
},
"sidebar.docs.category.FAQ": {
"message": "常见问题",

View File

@ -1,64 +0,0 @@
---
{
"title": "CANCEL LABEL",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# CANCEL LABEL
## description
NAME:
cancel_label: cancel a transaction with label
SYNOPSIS
curl -u user:passwd -XPOST http://host:port/api/{db}/_cancel?label={label}
DESCRIPTION
This is to cancel a transaction with specified label.
RETURN VALUES
Return a JSON format string:
Status:
Success: cancel succeed
Others: cancel failed
Message: Error message if cancel failed
ERRORS
## example
1. Cancel the transaction with label "testLabel" on database "testDb"
curl -u root -XPOST http://host:port/api/testDb/_cancel?label=testLabel
## keyword
CANCEL, LABEL

View File

@ -1,74 +0,0 @@
---
{
"title": "get\\_log\\_file",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# get\_log\_file
To get FE log via HTTP
## Types of FE log
1. fe.audit.log (Audit log)
The audit log records the all statements executed. Audit log's name format as follow:
```
fe.audit.log # The latest audit log
fe.audit.log.20190603.1 # The historical audit log. The smaller the sequence number, the newer the log.
fe.audit.log.20190603.2
fe.audit.log.20190602.1
...
```
## Example
1. Get the list of specified type of logs
Example
`curl -v -X HEAD -uuser:passwd http://fe_host:http_port/api/get_log_file?type=fe.audit.log`
Returns:
```
HTTP/1.1 200 OK
file_infos: {"fe.audit.log":24759,"fe.audit.log.20190528.1":132934}
content-type: text/html
connection: keep-alive
```
In the header of result, the `file_infos` section saves the file list and file size in JSON format.
2. Download files
Example:
```
curl -X GET -uuser:passwd http://fe_host:http_port/api/get_log_file?type=fe.audit.log\&file=fe.audit.log.20190528.1
```
## Notification
Need ADMIN privilege.

View File

@ -33,6 +33,12 @@ under the License.
## Description
Used to cancel the load transaction of the specified label.
RETURN VALUES
Return a JSON format string:
Status:
Success: cancel succeed
Others: cancel failed
Message: Error message if cancel failed
## Path parameters

View File

@ -0,0 +1,53 @@
---
{
"title": "Colocate Meta Action",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Colocate Meta Action
## Request
`GET /api/colocate`
`POST/DELETE /api/colocate/group_stable`
`POST /api/colocate/bucketseq`
## Description
Used to obtain or modify colocate group information.
## Path parameters
None
## Query parameters
None
## Request body
None
## Response
TO DO

View File

@ -1,6 +1,6 @@
---
{
"title": "CONNECTION",
"title": "Extra Basepath Action",
"language": "en"
}
---
@ -24,19 +24,35 @@ specific language governing permissions and limitations
under the License.
-->
# CONNECTION
# Extra Basepath Action
To get current query_id from connection
## Request
```
curl -X GET http://fe_host:fe_http_port/api/connection?connection_id=123
```
`GET /api/basepath`
If connection_id does not exist, return 404 NOT FOUND ERROR
## Description
Used to obtain http basepath.
## Path parameters
None
## Query parameters
None
## Request body
None
## Response
If connection_id exists, return last query_id belongs to connection_id
```
{
"query_id" : 9133b7efa92a44c8-8ed4b44772ec2a0c
"msg":"success",
"code":0,
"data":{"enable":false,"path":""},
"count":0
}
```

View File

@ -33,6 +33,12 @@ under the License.
## Description
Returns the status of the load transaction of the specified label
Return of JSON format string of the status of specified transaction:
Label: The specified label.
Status: Success or not of this request.
Message: Error messages
State:
UNKNOWN/PREPARE/COMMITTED/VISIBLE/ABORTED
## Path parameters

View File

@ -0,0 +1,61 @@
---
{
"title": "Help Action",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Help Action
## Request
`GET /rest/v1/help`
## Description
Used to obtain help through fuzzy query.
## Path parameters
None
## Query parameters
* `query`
Keywords to be matched, such as array and select.
## Request body
None
## Response
```
{
"msg":"success",
"code":0,
"data":{"fuzzy":"No Fuzzy Matching Topic","matching":"No Matching Category"},
"count":0
}
```

View File

@ -0,0 +1,53 @@
---
{
"title": "Import Action",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Import Action
## Request
`POST /api/import/file_review`
## Description
View the contents of the file in CSV or PARQUET format.
## Path parameters
None
## Query parameters
None
## Request body
TO DO
## Response
TO DO

View File

@ -0,0 +1,70 @@
---
{
"title": "Login Action",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Login Action
## Request
`POST /rest/v1/login`
## Description
Used to log in to the service.
## Path parameters
None
## Query parameters
None
## Request body
None
## Response
* Login success
```
{
"msg": "Login success!",
"code": 200
}
```
* Login failure
```
{
"msg": "Error msg...",
"code": xxx,
"data": "Error data...",
"count": 0
}
```

View File

@ -1,475 +0,0 @@
---
{
"title": "Query Profile Action",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Query Profile Action
## Request
`GET /rest/v2/manager/query/query_info`
`GET /rest/v2/manager/query/trace/{trace_id}`
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
`GET /rest/v2/manager/query/profile/graph/{query_id}`
`GET /rest/v2/manager/query/profile/json/{query_id}`
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
`GET /rest/v2/manager/query/current_queries`
`GET /rest/v2/manager/query/kill/{query_id}`
## Get the query information
`GET /rest/v2/manager/query/query_info`
### Description
Gets information about select queries for all fe nodes in the cluster.
### Query parameters
* `query_id`
Optional, specifies the query ID of the query to be returned, default returns information for all queries.
* `search`
Optional, specifies that query information containing strings is returned, currently only string matches are performed.
* `is_all_node`
Optional, if true, returns query information for all fe nodes, if false, returns query information for the current fe node. The default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
...
]
]
},
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。
</version>
### Examples
```
GET /rest/v2/manager/query/query_info
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
"d7c93d9275334c35-9e6ac5f295a7134b",
"127.0.0.1:8030",
"root",
"default_cluster:testdb",
"select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id",
"Query",
"2021-07-29 16:59:12",
"2021-07-29 16:59:12",
"109ms",
"EOF"
]
]
},
"count": 0
}
```
## Get Query Id By Trace Id
`GET /rest/v2/manager/query/trace_id/{trace_id}`
### Description
Get query id by trance id.
Before executing a Query, set a unique trace id:
`set set session_context="trace_id:your_trace_id";`
After executing the Query within the same Session, the query id can be obtained through the trace id.
### Path parameters
* `{trace_id}`
User specific trace id.
### Query parameters
### Response
```
{
"msg": "success",
"code": 0,
"data": "fb1d9737de914af1-a498d5c5dec638d3",
"count": 0
}
```
<version since="1.2">
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## Get the sql and text profile for the specified query
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
### Description
Get the sql and profile text for the specified query id.
### Path parameters
* `query_id`
The query id.
### Query parameters
* `is_all_node`
Optional, if true then query for the specified query id in all fe nodes, if false then query for the specified query id in the currently connected fe nodes. The default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"sql": ""
},
"count": 0
}
```
```
{
"msg": "success",
"code": 0,
"data": {
"profile": ""
},
"count": 0
}
```
<version since="1.2">
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
### Examples
1. get sql.
```
GET /rest/v2/manager/query/sql/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": {
"sql": "select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id"
},
"count": 0
}
```
## Get the specified query fragment and instance information
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
### Description
Get the fragment name, instance id and execution time for the specified query id.
### Path parameters
* `query_id`
The query id.
### Query parameters
* `is_all_node`
Optional, if true then query for the specified query id in all fe nodes, if false then query for the specified query id in the currently connected fe nodes. The default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "",
"time": "",
"instance_id": {
"": ""
}
}
],
"count": 0
}
```
<version since="1.2">
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
### Examples
```
GET /rest/v2/manager/query/profile/fragments/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "0",
"time": "36.169ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134e": "36.169ms"
}
},
{
"fragment_id": "1",
"time": "20.710ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134c": "20.710ms"
}
},
{
"fragment_id": "2",
"time": "7.83ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134d": "7.83ms"
}
}
],
"count": 0
}
```
## Get the specified query id tree profile information
`GET /rest/v2/manager/query/profile/graph/{query_id}`
### Description
Get the tree profile information of the specified query id, same as `show query profile` command.
### Path parameters
* `query_id`
The query id.
### Query parameters
* `fragment_id` and `instance_id`
Optional, both parameters must be specified or not.
If both are not specified, a simple tree of profiles is returned, equivalent to `show query profile '/query_id'`;
If both are specified, a detailed profile tree is returned, which is equivalent to `show query profile '/query_id/fragment_id/instance_id'`.
* `is_all_node`
Optional, if true then query information about the specified query id in all fe nodes, if false then query information about the specified query id in the currently connected fe nodes. The default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"graph":""
},
"count": 0
}
```
<version since="1.2">
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## Current running queries
`GET /rest/v2/manager/query/current_queries`
### Description
Same as `show proc "/current_query_stmts"`, return current running queries.
### Path parameters
### Query parameters
* `is_all_node`
Optional. Return current running queries from all FE if set to true. Default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"columnNames": ["Frontend", "QueryId", "ConnectionId", "Database", "User", "ExecTime", "SqlHash", "Statement"],
"rows": [
["172.19.0.3", "108e47ab438a4560-ab1651d16c036491", "2", "", "root", "6074", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"],
["172.19.0.11", "3606cad4e34b49c6-867bf6862cacc645", "3", "", "root", "9306", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"]
]
},
"count": 0
}
```
## Cancel query
`POST /rest/v2/manager/query/kill/{query_id}`
### Description
Cancel query of specified connection.
### Path parameters
* `{query_id}`
query id. You can get query id by `trance_id` api.
### Query parameters
### Response
```
{
"msg": "success",
"code": 0,
"data": null,
"count": 0
}
```

View File

@ -0,0 +1,72 @@
---
{
"title": "Meta Info Action",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Meta Info Action
## Request
`GET /api/meta/namespaces/<ns>/databases`
`GET /api/meta/namespaces/<ns>/databases/<db>/tables`
`GET /api/meta/namespaces/<ns>/databases/<db>/tables/<tbl>/schema`
## Description
Used to obtain metadata information about the cluster, including the database list, table list, and table schema.
## Path parameters
* `ns`
Specify cluster name.
* `db`
Specify database name.
* `tbl`
Specify table name.
## Query parameters
None
## Request body
None
## Response
```
{
"msg":"success",
"code":0,
"data":["databese list" / "table list" / "table schema"],
"count":0
}
```

View File

@ -1,6 +1,6 @@
---
{
"title": "SHOW DATA",
"title": "Metrics Action",
"language": "en"
}
---
@ -24,12 +24,25 @@ specific language governing permissions and limitations
under the License.
-->
# SHOW DATA
To all size occupied by cluster
# Metrics Action
```
curl -X GET http://fe_host:fe_http_port/api/show_data
```
## Request
`GET /api/metrics`
## Description
Used to obtain doris metrics infomation.
## Path parameters
None
## Query parameters
None
## Request body
None
The return value is the total size of the cluster

View File

@ -33,6 +33,92 @@ under the License.
## Description
Used to obtain the query profile of the specified query id.
If query_id is not exists, return 404 NOT FOUND ERROR
If query_id exists, return query profile like this
```
Query:
Summary:
- Query ID: a0a9259df9844029-845331577440a3bd
- Start Time: 2020-06-15 14:10:05
- End Time: 2020-06-15 14:10:05
- Total: 8ms
- Query Type: Query
- Query State: EOF
- Doris Version: trunk
- User: root
- Default Db: default_cluster:test
- Sql Statement: select * from table1
Execution Profile a0a9259df9844029-845331577440a3bd:(Active: 7.315ms, % non-child: 100.00%)
Fragment 0:
Instance a0a9259df9844029-845331577440a3be (host=TNetworkAddress(hostname:172.26.108.176, port:9560)):(Active: 1.523ms, % non-child: 0.24%)
- MemoryLimit: 2.00 GB
- PeakUsedReservation: 0.00
- PeakMemoryUsage: 72.00 KB
- RowsProduced: 5
- AverageThreadTokens: 0.00
- PeakReservation: 0.00
BlockMgr:
- BlocksCreated: 0
- BlockWritesOutstanding: 0
- BytesWritten: 0.00
- TotalEncryptionTime: 0ns
- BufferedPins: 0
- TotalReadBlockTime: 0ns
- TotalBufferWaitTime: 0ns
- BlocksRecycled: 0
- TotalIntegrityCheckTime: 0ns
- MaxBlockSize: 8.00 MB
DataBufferSender (dst_fragment_instance_id=a0a9259df9844029-845331577440a3be):
- AppendBatchTime: 9.23us
- ResultRendTime: 956ns
- TupleConvertTime: 5.735us
- NumSentRows: 5
OLAP_SCAN_NODE (id=0):(Active: 1.506ms, % non-child: 20.59%)
- TotalRawReadTime: 0ns
- CompressedBytesRead: 6.47 KB
- PeakMemoryUsage: 0.00
- RowsPushedCondFiltered: 0
- ScanRangesComplete: 0
- ScanTime: 25.195us
- BitmapIndexFilterTimer: 0ns
- BitmapIndexFilterCount: 0
- NumScanners: 65
- RowsStatsFiltered: 0
- VectorPredEvalTime: 0ns
- BlockSeekTime: 1.299ms
- RawRowsRead: 1.91K (1910)
- ScannerThreadsVoluntaryContextSwitches: 0
- RowsDelFiltered: 0
- IndexLoadTime: 911.104us
- NumDiskAccess: 1
- ScannerThreadsTotalWallClockTime: 0ns
- MaterializeTupleTime: 0ns
- ScannerThreadsUserTime: 0ns
- ScannerThreadsSysTime: 0ns
- TotalPagesNum: 0
- RowsReturnedRate: 3.319K /sec
- BlockLoadTime: 539.289us
- CachedPagesNum: 0
- BlocksLoad: 384
- UncompressedBytesRead: 0.00
- RowsBloomFilterFiltered: 0
- TabletCount : 1
- RowsReturned: 5
- ScannerThreadsInvoluntaryContextSwitches: 0
- DecompressorTimer: 0ns
- RowsVectorPredFiltered: 0
- ReaderInitTime: 6.498ms
- RowsRead: 5
- PerReadThreadRawHdfsThroughput: 0.0 /sec
- BlockFetchTime: 4.318ms
- ShowHintsTime: 0ns
- TotalReadThroughput: 0.0 /sec
- IOTimer: 1.154ms
- BytesRead: 48.49 KB
- BlockConvertTime: 97.539us
- BlockSeekCount: 0
```
## Path parameters

View File

@ -0,0 +1,108 @@
---
{
"title": "Query Profile Action",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Query Profile Action
## Request
```
GET /rest/v1/query_profile/<query_id>
```
## Description
The Query Profile Action is used to obtain the Query profile.
## Path parameters
* `<query_id>`
Optional parameters. When not specified, the latest query list is returned. When specified, return the profile of the specified query.
## Query parameters
None
## Request body
None
## Response
* Not specify `<query_id>`
```
GET /rest/v1/query_profile/
{
"msg": "success",
"code": 0,
"data": {
"href_column": ["Query ID"],
"column_names": ["Query ID", "User", "Default Db", "Sql Statement", "Query Type", "Start Time", "End Time", "Total", "Query State"],
"rows": [{
"User": "root",
"__hrefPath": ["/query_profile/d73a8a0b004f4b2f-b4829306441913da"],
"Query Type": "Query",
"Total": "5ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "d73a8a0b004f4b2f-b4829306441913da",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}, {
"User": "root",
"__hrefPath": ["/query_profile/fd706dd066824c21-9d1a63af9f5cb50c"],
"Query Type": "Query",
"Total": "6ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "fd706dd066824c21-9d1a63af9f5cb50c",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}]
},
"count": 3
}
```
The returned result is the same as `System Action`, which is a table description.
* Specify `<query_id>`
```
GET /rest/v1/query_profile/<query_id>
{
"msg": "success",
"code": 0,
"data": "Query:</br>&nbsp;&nbsp;&nbsp;&nbsp;Summary:</br>...",
"count": 0
}
```
`data` is the text content of the profile.

View File

@ -28,81 +28,448 @@ under the License.
## Request
`GET /rest/v2/manager/query/query_info`
`GET /rest/v2/manager/query/trace/{trace_id}`
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
`GET /rest/v2/manager/query/profile/graph/{query_id}`
`GET /rest/v2/manager/query/profile/json/{query_id}`
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
`GET /rest/v2/manager/query/current_queries`
`GET /rest/v2/manager/query/kill/{query_id}`
## Get the query information
`GET /rest/v2/manager/query/query_info`
### Description
Gets information about select queries for all fe nodes in the cluster.
### Query parameters
* `query_id`
Optional, specifies the query ID of the query to be returned, default returns information for all queries.
* `search`
Optional, specifies that query information containing strings is returned, currently only string matches are performed.
* `is_all_node`
Optional, if true, returns query information for all fe nodes, if false, returns query information for the current fe node. The default is true.
### Response
```
GET /rest/v1/query_profile/<query_id>
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
...
]
]
},
"count": 0
}
```
## Description
<version since="1.2">
The Query Profile Action is used to obtain the Query profile.
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。
</version>
### Examples
```
GET /rest/v2/manager/query/query_info
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
"d7c93d9275334c35-9e6ac5f295a7134b",
"127.0.0.1:8030",
"root",
"default_cluster:testdb",
"select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id",
"Query",
"2021-07-29 16:59:12",
"2021-07-29 16:59:12",
"109ms",
"EOF"
]
]
},
"count": 0
}
```
## Get Query Id By Trace Id
`GET /rest/v2/manager/query/trace_id/{trace_id}`
### Description
Get query id by trance id.
Before executing a Query, set a unique trace id:
`set set session_context="trace_id:your_trace_id";`
After executing the Query within the same Session, the query id can be obtained through the trace id.
## Path parameters
### Path parameters
* `<query_id>`
* `{trace_id}`
Optional parameters. When not specified, the latest query list is returned. When specified, return the profile of the specified query.
User specific trace id.
## Query parameters
### Query parameters
### Response
## Request body
```
{
"msg": "success",
"code": 0,
"data": "fb1d9737de914af1-a498d5c5dec638d3",
"count": 0
}
```
<version since="1.2">
## Response
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
* Not specify `<query_id>`
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## Get the sql and text profile for the specified query
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
### Description
Get the sql and profile text for the specified query id.
### Path parameters
* `query_id`
The query id.
### Query parameters
* `is_all_node`
Optional, if true then query for the specified query id in all fe nodes, if false then query for the specified query id in the currently connected fe nodes. The default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"sql": ""
},
"count": 0
}
```
```
{
"msg": "success",
"code": 0,
"data": {
"profile": ""
},
"count": 0
}
```
<version since="1.2">
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
### Examples
1. get sql.
```
GET /rest/v1/query_profile/
GET /rest/v2/manager/query/sql/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": {
"href_column": ["Query ID"],
"column_names": ["Query ID", "User", "Default Db", "Sql Statement", "Query Type", "Start Time", "End Time", "Total", "Query State"],
"rows": [{
"User": "root",
"__hrefPath": ["/query_profile/d73a8a0b004f4b2f-b4829306441913da"],
"Query Type": "Query",
"Total": "5ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "d73a8a0b004f4b2f-b4829306441913da",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}, {
"User": "root",
"__hrefPath": ["/query_profile/fd706dd066824c21-9d1a63af9f5cb50c"],
"Query Type": "Query",
"Total": "6ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "fd706dd066824c21-9d1a63af9f5cb50c",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}]
},
"count": 3
"msg": "success",
"code": 0,
"data": {
"sql": "select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id"
},
"count": 0
}
```
## Get the specified query fragment and instance information
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
### Description
Get the fragment name, instance id and execution time for the specified query id.
The returned result is the same as `System Action`, which is a table description.
### Path parameters
* `query_id`
The query id.
### Query parameters
* `is_all_node`
Optional, if true then query for the specified query id in all fe nodes, if false then query for the specified query id in the currently connected fe nodes. The default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "",
"time": "",
"instance_id": {
"": ""
}
}
],
"count": 0
}
```
<version since="1.2">
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
* Specify `<query_id>`
### Examples
```
GET /rest/v1/query_profile/<query_id>
GET /rest/v2/manager/query/profile/fragments/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": "Query:</br>&nbsp;&nbsp;&nbsp;&nbsp;Summary:</br>...",
"count": 0
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "0",
"time": "36.169ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134e": "36.169ms"
}
},
{
"fragment_id": "1",
"time": "20.710ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134c": "20.710ms"
}
},
{
"fragment_id": "2",
"time": "7.83ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134d": "7.83ms"
}
}
],
"count": 0
}
```
## Get the specified query id tree profile information
`GET /rest/v2/manager/query/profile/graph/{query_id}`
### Description
Get the tree profile information of the specified query id, same as `show query profile` command.
`data` is the text content of the profile.
### Path parameters
* `query_id`
The query id.
### Query parameters
* `fragment_id` and `instance_id`
Optional, both parameters must be specified or not.
If both are not specified, a simple tree of profiles is returned, equivalent to `show query profile '/query_id'`;
If both are specified, a detailed profile tree is returned, which is equivalent to `show query profile '/query_id/fragment_id/instance_id'`.
* `is_all_node`
Optional, if true then query information about the specified query id in all fe nodes, if false then query information about the specified query id in the currently connected fe nodes. The default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"graph":""
},
"count": 0
}
```
<version since="1.2">
Admin and Root user can view all queries. Ordinary users can only view the Query sent by themselves. If the specified trace id does not exist or has no permission, it will return Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## Current running queries
`GET /rest/v2/manager/query/current_queries`
### Description
Same as `show proc "/current_query_stmts"`, return current running queries.
### Path parameters
### Query parameters
* `is_all_node`
Optional. Return current running queries from all FE if set to true. Default is true.
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"columnNames": ["Frontend", "QueryId", "ConnectionId", "Database", "User", "ExecTime", "SqlHash", "Statement"],
"rows": [
["172.19.0.3", "108e47ab438a4560-ab1651d16c036491", "2", "", "root", "6074", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"],
["172.19.0.11", "3606cad4e34b49c6-867bf6862cacc645", "3", "", "root", "9306", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"]
]
},
"count": 0
}
```
## Cancel query
`POST /rest/v2/manager/query/kill/{query_id}`
### Description
Cancel query of specified connection.
### Path parameters
* `{query_id}`
query id. You can get query id by `trance_id` api.
### Query parameters
### Response
```
{
"msg": "success",
"code": 0,
"data": null,
"count": 0
}
```

View File

@ -0,0 +1,58 @@
---
{
"title": "Statistic Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Statistic Action
## Request
`GET /rest/v2/api/cluster_overview`
## Description
获取集群统计信息、库表数量等。
## Path parameters
## Query parameters
## Request body
## Response
```
{
"msg":"success",
"code":0,
"data":{"diskOccupancy":0,"remainDisk":5701197971457,"feCount":1,"tblCount":27,"beCount":1,"dbCount":2},
"count":0
}
```

View File

@ -1,59 +0,0 @@
---
{
"title": "GET LABEL STATE",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# GET LABEL STATE
## description
NAME:
get_load_state: get load's state of label
SYNOPSIS
curl -u user:passwd http://host:port/api/{db}/get_load_state?label=xxx
DESCRIPTION
Check the status of a transaction
RETURN VALUES
Return of JSON format string of the status of specified transaction:
Label: The specified label.
Status: Success or not of this request.
Message: Error messages
State:
UNKNOWN/PREPARE/COMMITTED/VISIBLE/ABORTED
ERRORS
## example
1. Get status of label "testLabel" on database "testDb"
curl -u root http://host:port/api/testDb/get_load_state?label=testLabel
## keyword
GET, LOAD, STATE

View File

@ -1,120 +0,0 @@
---
{
"title": "PROFILE",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# PROFILE
To get query profile using query_id
```
curl -X GET http://fe_host:fe_http_port/api/profile?query_id=123
```
If query_id is not exists, return 404 NOT FOUND ERROR
If query_id exists, return query profile like this
```
Query:
Summary:
- Query ID: a0a9259df9844029-845331577440a3bd
- Start Time: 2020-06-15 14:10:05
- End Time: 2020-06-15 14:10:05
- Total: 8ms
- Query Type: Query
- Query State: EOF
- Doris Version: trunk
- User: root
- Default Db: default_cluster:test
- Sql Statement: select * from table1
Execution Profile a0a9259df9844029-845331577440a3bd:(Active: 7.315ms, % non-child: 100.00%)
Fragment 0:
Instance a0a9259df9844029-845331577440a3be (host=TNetworkAddress(hostname:172.26.108.176, port:9560)):(Active: 1.523ms, % non-child: 0.24%)
- MemoryLimit: 2.00 GB
- PeakUsedReservation: 0.00
- PeakMemoryUsage: 72.00 KB
- RowsProduced: 5
- AverageThreadTokens: 0.00
- PeakReservation: 0.00
BlockMgr:
- BlocksCreated: 0
- BlockWritesOutstanding: 0
- BytesWritten: 0.00
- TotalEncryptionTime: 0ns
- BufferedPins: 0
- TotalReadBlockTime: 0ns
- TotalBufferWaitTime: 0ns
- BlocksRecycled: 0
- TotalIntegrityCheckTime: 0ns
- MaxBlockSize: 8.00 MB
DataBufferSender (dst_fragment_instance_id=a0a9259df9844029-845331577440a3be):
- AppendBatchTime: 9.23us
- ResultRendTime: 956ns
- TupleConvertTime: 5.735us
- NumSentRows: 5
OLAP_SCAN_NODE (id=0):(Active: 1.506ms, % non-child: 20.59%)
- TotalRawReadTime: 0ns
- CompressedBytesRead: 6.47 KB
- PeakMemoryUsage: 0.00
- RowsPushedCondFiltered: 0
- ScanRangesComplete: 0
- ScanTime: 25.195us
- BitmapIndexFilterTimer: 0ns
- BitmapIndexFilterCount: 0
- NumScanners: 65
- RowsStatsFiltered: 0
- VectorPredEvalTime: 0ns
- BlockSeekTime: 1.299ms
- RawRowsRead: 1.91K (1910)
- ScannerThreadsVoluntaryContextSwitches: 0
- RowsDelFiltered: 0
- IndexLoadTime: 911.104us
- NumDiskAccess: 1
- ScannerThreadsTotalWallClockTime: 0ns
- MaterializeTupleTime: 0ns
- ScannerThreadsUserTime: 0ns
- ScannerThreadsSysTime: 0ns
- TotalPagesNum: 0
- RowsReturnedRate: 3.319K /sec
- BlockLoadTime: 539.289us
- CachedPagesNum: 0
- BlocksLoad: 384
- UncompressedBytesRead: 0.00
- RowsBloomFilterFiltered: 0
- TabletCount : 1
- RowsReturned: 5
- ScannerThreadsInvoluntaryContextSwitches: 0
- DecompressorTimer: 0ns
- RowsVectorPredFiltered: 0
- ReaderInitTime: 6.498ms
- RowsRead: 5
- PerReadThreadRawHdfsThroughput: 0.0 /sec
- BlockFetchTime: 4.318ms
- ShowHintsTime: 0ns
- TotalReadThroughput: 0.0 /sec
- IOTimer: 1.154ms
- BytesRead: 48.49 KB
- BlockConvertTime: 97.539us
- BlockSeekCount: 0
```

View File

@ -1,61 +0,0 @@
---
{
"title": "QUERY DETAIL",
"language": "en"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# QUERY DETAIL
Collect the query details from FE. You should set the event_time.
FE will return the query detail after the event_time.
The unit of event_time is milliseconds.
```
curl -X GET http://fe_host:fe_http_port/api/query_detail?event_time=1592054515284
```
The query details will be be returned as JSON
```
[
{
"eventTime": 1592201405063,
"queryId": "a0a9259df9844029-845331577440a3bd",
"startTime": 1592201405055,
"endTime": 1592201405063,
"latency": 8,
"state": "FINISHED",
"database": "test",
"sql": "select * from table1"
},
{
"eventTime": 1592201420842,
"queryId": "21cd79c3e1634e8a-bdac090c7e7bcc36",
"startTime": 1592201420834,
"endTime": 1592201420842,
"latency": 8,
"state": "FINISHED",
"database": "test",
"sql": "select * from table1"
}
]
```

View File

@ -1090,69 +1090,72 @@
"type": "category",
"label": "FE",
"items": [
{
"type": "category",
"label": "MANAGER",
"items": [
"admin-manual/http-actions/fe/manager/query-profile-action",
"admin-manual/http-actions/fe/manager/node-action",
"admin-manual/http-actions/fe/manager/cluster-action"
]
},
"admin-manual/http-actions/fe/get-load-state",
"admin-manual/http-actions/fe/bootstrap-action",
"admin-manual/http-actions/fe/ha-action",
"admin-manual/http-actions/fe/meta-replay-state-action",
"admin-manual/http-actions/fe/statement-execution-action",
"admin-manual/http-actions/fe/profile-action",
"admin-manual/http-actions/fe/meta-info-action",
"admin-manual/http-actions/fe/meta-action",
"admin-manual/http-actions/fe/query-profile-action",
"admin-manual/http-actions/fe/show-data-action",
"admin-manual/http-actions/fe/config-action",
"admin-manual/http-actions/fe/get-log-file-action",
"admin-manual/http-actions/fe/connection-action",
"admin-manual/http-actions/fe/system-action",
"admin-manual/http-actions/fe/table-schema-action",
"admin-manual/http-actions/fe/show-meta-info-action",
"admin-manual/http-actions/fe/ha-action",
"admin-manual/http-actions/fe/hardware-info-action",
"admin-manual/http-actions/fe/help-action",
"admin-manual/http-actions/fe/log-action",
"admin-manual/http-actions/fe/cancel-load-action",
"admin-manual/http-actions/fe/login-action",
"admin-manual/http-actions/fe/logout-action",
"admin-manual/http-actions/fe/backends-action",
"admin-manual/http-actions/fe/get-load-info-action",
"admin-manual/http-actions/fe/show-runtime-info-action",
"admin-manual/http-actions/fe/query-detail-action",
"admin-manual/http-actions/fe/upload-action",
"admin-manual/http-actions/fe/query-profile-action-controller",
"admin-manual/http-actions/fe/session-action",
"admin-manual/http-actions/fe/table-row-count-action",
"admin-manual/http-actions/fe/get-small-file",
"admin-manual/http-actions/fe/table-query-plan-action",
"admin-manual/http-actions/fe/set-config-action",
"admin-manual/http-actions/fe/row-count-action",
"admin-manual/http-actions/fe/get-ddl-stmt-action",
"admin-manual/http-actions/fe/show-proc-action",
"admin-manual/http-actions/fe/system-action",
"admin-manual/http-actions/fe/colocate-meta-action",
"admin-manual/http-actions/fe/meta-action",
"admin-manual/http-actions/fe/cluster-action",
"admin-manual/http-actions/fe/node-action",
"admin-manual/http-actions/fe/query-profile-action",
"admin-manual/http-actions/fe/backends-action",
"admin-manual/http-actions/fe/bootstrap-action",
"admin-manual/http-actions/fe/cancel-load-action",
"admin-manual/http-actions/fe/check-decommission-action",
"admin-manual/http-actions/fe/health-action",
"admin-manual/http-actions/fe/check-storage-type-action",
"admin-manual/http-actions/fe/query-schema-action"
"admin-manual/http-actions/fe/connection-action",
"admin-manual/http-actions/fe/extra-basepath-action",
"admin-manual/http-actions/fe/fe-version-info-action",
"admin-manual/http-actions/fe/get-ddl-stmt-action",
"admin-manual/http-actions/fe/get-load-info-action",
"admin-manual/http-actions/fe/get-load-state",
"admin-manual/http-actions/fe/get-log-file-action",
"admin-manual/http-actions/fe/get-small-file",
"admin-manual/http-actions/fe/health-action",
"admin-manual/http-actions/fe/meta-info-action",
"admin-manual/http-actions/fe/meta-replay-state-action",
"admin-manual/http-actions/fe/metrics-action",
"admin-manual/http-actions/fe/profile-action",
"admin-manual/http-actions/fe/query-detail-action",
"admin-manual/http-actions/fe/query-schema-action",
"admin-manual/http-actions/fe/row-count-action",
"admin-manual/http-actions/fe/set-config-action",
"admin-manual/http-actions/fe/show-data-action",
"admin-manual/http-actions/fe/show-meta-info-action",
"admin-manual/http-actions/fe/show-proc-action",
"admin-manual/http-actions/fe/show-runtime-info-action",
"admin-manual/http-actions/fe/statement-execution-action",
"admin-manual/http-actions/fe/table-query-plan-action",
"admin-manual/http-actions/fe/table-row-count-action",
"admin-manual/http-actions/fe/table-schema-action",
"admin-manual/http-actions/fe/upload-action",
"admin-manual/http-actions/fe/import-action",
"admin-manual/http-actions/fe/meta-info-action-V2",
"admin-manual/http-actions/fe/statistic-action"
]
},
"admin-manual/http-actions/restore-tablet",
"admin-manual/http-actions/pad-rowset",
"admin-manual/http-actions/get-load-state",
"admin-manual/http-actions/tablet-migration-action",
"admin-manual/http-actions/cancel-label",
"admin-manual/http-actions/profile-action",
"admin-manual/http-actions/show-data-action",
"admin-manual/http-actions/tablets_distribution",
"admin-manual/http-actions/connection-action",
"admin-manual/http-actions/compaction-action",
"admin-manual/http-actions/query-detail-action",
"admin-manual/http-actions/get-tablets",
"admin-manual/http-actions/fe-get-log-file",
"admin-manual/http-actions/check-reset-rpc-cache",
"admin-manual/http-actions/check-tablet-segment-action"
{
"type": "category",
"label": "BE",
"items": [
"admin-manual/http-actions/be/be-version-info-action",
"admin-manual/http-actions/be/restore-tablet",
"admin-manual/http-actions/be/pad-rowset",
"admin-manual/http-actions/be/tablet-migration-action",
"admin-manual/http-actions/be/tablets_distribution",
"admin-manual/http-actions/be/compaction-action",
"admin-manual/http-actions/be/get-tablets",
"admin-manual/http-actions/be/check-reset-rpc-cache",
"admin-manual/http-actions/be/check-tablet-segment-action"
]
}
]
}
]

View File

@ -1,59 +0,0 @@
---
{
"title": "CANCEL LABEL",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# CANCEL LABEL
## description
NAME:
cancel_label: cancel a transaction with label
SYNOPSIS
curl -u user:passwd -XPOST http://host:port/api/{db}/_cancel?label={label}
DESCRIPTION
该命令用于cancel一个指定Label对应的事务,事务在Prepare阶段能够被成功cancel
RETURN VALUES
执行完成后,会以Json格式返回这次导入的相关内容。当前包括以下字段
Status: 是否成功cancel
Success: 成功cancel事务
其他: cancel失败
Message: 具体的失败信息
ERRORS
## example
1. cancel testDb, testLabel的作业
curl -u root -XPOST http://host:port/api/testDb/_cancel?label=testLabel
## keyword
CANCEL,LABEL

View File

@ -1,80 +0,0 @@
---
{
"title": "get\\_log\\_file",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# get\_log\_file
用户可以通过该 HTTP 接口获取 FE 的日志文件。
## 日志类型
支持获取以下类型的 FE 日志:
1. fe.audit.log(审计日志)
审计日志记录了对应 FE 节点的所有请求语句已经请求的信息。审计日志的文件命名规则如下:
```
fe.audit.log # 当前的最新日志
fe.audit.log.20190603.1 # 对应日期的审计日志,当对应日期的日志大小超过 1GB 后,会生成序号后缀。序号越小的日志,内容越新。
fe.audit.log.20190603.2
fe.audit.log.20190602.1
...
```
## 接口示例
1. 获取对应类型的日志文件列表
示例:
`curl -v -X HEAD -uuser:passwd http://fe_host:http_port/api/get_log_file?type=fe.audit.log`
返回结果:
```
HTTP/1.1 200 OK
file_infos: {"fe.audit.log":24759,"fe.audit.log.20190528.1":132934}
content-type: text/html
connection: keep-alive
```
在返回的 header 中,`file_infos` 字段以 json 格式展示文件列表以及对应文件大小(单位字节)
2. 下载日志文件
示例:
```
curl -X GET -uuser:passwd http://fe_host:http_port/api/get_log_file?type=fe.audit.log\&file=fe.audit.log.20190528.1
```
返回结果:
以文件的形式下载指定的文件。
## 接口说明
该接口需要 admin 权限。

View File

@ -33,6 +33,11 @@ under the License.
## Description
用于取消掉指定label的导入任务。
执行完成后,会以Json格式返回这次导入的相关内容。当前包括以下字段
Status: 是否成功cancel
Success: 成功cancel事务
其他: cancel失败
Message: 具体的失败信息
## Path parameters

View File

@ -0,0 +1,53 @@
---
{
"title": "Colocate Meta Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Colocate Meta Action
## Request
`GET /api/colocate`
`POST/DELETE /api/colocate/group_stable`
`POST /api/colocate/bucketseq`
## Description
获取/修改colocate group信息。
## Path parameters
## Query parameters
## Request body
## Response
TO DO

View File

@ -1,6 +1,6 @@
---
{
"title": "CONNECTION",
"title": "Extra Basepath Action",
"language": "zh-CN"
}
---
@ -24,19 +24,35 @@ specific language governing permissions and limitations
under the License.
-->
# CONNECTION
通过connection_id, 获取当前连接的query_id
# Extra Basepath Action
```
curl -X GET http://fe_host:fe_http_port/api/connection?connection_id=123
```
## Request
如果connection_id不存在,直接返回404 NOT FOUND错误
`GET /api/basepath`
## Description
获取http 的basepath。
## Path parameters
## Query parameters
## Request body
## Response
如果connection_id存在,会返回当前connection_id上一个进行的query_id
```
{
"query_id" : 9133b7efa92a44c8-8ed4b44772ec2a0c
"msg":"success",
"code":0,
"data":{"enable":false,"path":""},
"count":0
}
```

View File

@ -33,6 +33,16 @@ under the License.
## Description
返回指定label的导入事务的状态
执行完毕后,会以Json格式返回这次导入的相关内容。当前包括以下字段:
Label:本次导入的 label,如果没有指定,则为一个 uuid
Status:此命令是否成功执行,Success表示成功执行
Message: 具体的执行信息
State: 只有在Status为Success时才有意义
UNKNOWN: 没有找到对应的Label
PREPARE: 对应的事务已经prepare,但尚未提交
COMMITTED: 事务已经提交,不能被cancel
VISIBLE: 事务提交,并且数据可见,不能被cancel
ABORTED: 事务已经被ROLLBACK,导入已经失败
## Path parameters

View File

@ -0,0 +1,61 @@
---
{
"title": "Help Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Help Action
## Request
`GET /rest/v1/help`
## Description
用于通过模糊查询获取帮助。
## Path parameters
## Query parameters
* `query`
需要进行匹配的关键词,如array、select等。
## Request body
## Response
```
{
"msg":"success",
"code":0,
"data":{"fuzzy":"No Fuzzy Matching Topic","matching":"No Matching Category"},
"count":0
}
```

View File

@ -0,0 +1,53 @@
---
{
"title": "Import Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Import Action
## Request
`POST /api/import/file_review`
## Description
查看格式为CSV或PARQUET的文件内容。
## Path parameters
## Query parameters
## Request body
TO DO
## Response
TO DO

View File

@ -0,0 +1,70 @@
---
{
"title": "Login Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Login Action
## Request
`POST /rest/v1/login`
## Description
用于登录服务。
## Path parameters
## Query parameters
## Request body
## Response
* 登录成功
```
{
"msg": "Login success!",
"code": 200
}
```
* 登录失败
```
{
"msg": "Error msg...",
"code": xxx,
"data": "Error data...",
"count": 0
}
```

View File

@ -1,476 +0,0 @@
---
{
"title": "Query Profile Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Query Profile Action
## Request
`GET /rest/v2/manager/query/query_info`
`GET /rest/v2/manager/query/trace/{trace_id}`
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
`GET /rest/v2/manager/query/profile/graph/{query_id}`
`GET /rest/v2/manager/query/profile/json/{query_id}`
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
`GET /rest/v2/manager/query/current_queries`
`GET /rest/v2/manager/query/kill/{query_id}`
## 获取查询信息
`GET /rest/v2/manager/query/query_info`
### Description
可获取集群所有 fe 节点 select 查询信息。
### Query parameters
* `query_id`
可选,指定返回查询的queryID, 默认返回所有查询的信息。
* `search`
可选,指定返回包含字符串的查询信息,目前仅进行字符串匹配。
* `is_all_node`
可选,若为 true 则返回所有fe节点的查询信息,若为 false 则返回当前fe节点的查询信息。默认为true。
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
...
]
]
},
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。
</version>
### Examples
```
GET /rest/v2/manager/query/query_info
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
"d7c93d9275334c35-9e6ac5f295a7134b",
"127.0.0.1:8030",
"root",
"default_cluster:testdb",
"select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id",
"Query",
"2021-07-29 16:59:12",
"2021-07-29 16:59:12",
"109ms",
"EOF"
]
]
},
"count": 0
}
```
## 通过 Trace Id 获取 Query Id
`GET /rest/v2/manager/query/trace_id/{trace_id}`
### Description
通过 Trace Id 获取 Query Id.
在执行一个 Query 前,先设置一个唯一的 trace id:
`set set session_context="trace_id:your_trace_id";`
在同一个 Session 链接内执行 Query 后,可以通过 trace id 获取 query id。
### Path parameters
* `{trace_id}`
用户设置的 trace id.
### Query parameters
### Response
```
{
"msg": "success",
"code": 0,
"data": "fb1d9737de914af1-a498d5c5dec638d3",
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 trace id 不存在或无权限,则返回 Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## 获取指定查询的sql和文本profile
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
### Description
用于获取指定query id的sql和profile文本。
### Path parameters
* `query_id`
query id。
### Query parameters
* `is_all_node`
可选,若为 true 则在所有fe节点中查询指定query id的信息,若为 false 则在当前连接的fe节点中查询指定query id的信息。默认为true。
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"sql": ""
},
"count": 0
}
```
```
{
"msg": "success",
"code": 0,
"data": {
"profile": ""
},
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 query id 不存在或无权限,则返回 Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
### Examples
1. 获取 sql:
```
GET /rest/v2/manager/query/sql/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": {
"sql": "select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id"
},
"count": 0
}
```
## 获取指定查询fragment和instance信息
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
### Description
用于获取指定query id的fragment名称,instance id和执行时长。
### Path parameters
* `query_id`
query id。
### Query parameters
* `is_all_node`
可选,若为 true 则在所有fe节点中查询指定query id的信息,若为 false 则在当前连接的fe节点中查询指定query id的信息。默认为true。
### Response
```
{
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "",
"time": "",
"instance_id": {
"": ""
}
}
],
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 query id 不存在或无权限,则返回 Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
### Examples
```
GET /rest/v2/manager/query/profile/fragments/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "0",
"time": "36.169ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134e": "36.169ms"
}
},
{
"fragment_id": "1",
"time": "20.710ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134c": "20.710ms"
}
},
{
"fragment_id": "2",
"time": "7.83ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134d": "7.83ms"
}
}
],
"count": 0
}
```
## 获取指定query id树状profile信息
`GET /rest/v2/manager/query/profile/graph/{query_id}`
### Description
获取指定query id树状profile信息,同 `show query profile` 指令。
### Path parameters
* `query_id`
query id。
### Query parameters
* `fragment_id` 和 `instance_id`
可选,这两个参数需同时指定或同时不指定。
同时不指定则返回profile 简易树形图,相当于`show query profile '/query_id'`;
同时指定则返回指定instance详细profile树形图,相当于`show query profile '/query_id/fragment_id/instance_id'`.
* `is_all_node`
可选,若为 true 则在所有fe节点中查询指定query id的信息,若为 false 则在当前连接的fe节点中查询指定query id的信息。默认为true。
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"graph":""
},
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 query id 不存在或无权限,则返回 Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## 正在执行的query
`GET /rest/v2/manager/query/current_queries`
### Description
同 `show proc "/current_query_stmts"`,返回当前正在执行的 query
### Path parameters
### Query parameters
* `is_all_node`
可选,若为 true 则返回所有FE节点当前正在执行的 query 信息。默认为 true。
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"columnNames": ["Frontend", "QueryId", "ConnectionId", "Database", "User", "ExecTime", "SqlHash", "Statement"],
"rows": [
["172.19.0.3", "108e47ab438a4560-ab1651d16c036491", "2", "", "root", "6074", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"],
["172.19.0.11", "3606cad4e34b49c6-867bf6862cacc645", "3", "", "root", "9306", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"]
]
},
"count": 0
}
```
## 取消query
`POST /rest/v2/manager/query/kill/{query_id}`
### Description
取消执行连接中正在执行的 query
### Path parameters
* `{query_id}`
query id. 你可以通过 trace_id 接口,获取 query id。
### Query parameters
### Response
```
{
"msg": "success",
"code": 0,
"data": null,
"count": 0
}
```

View File

@ -0,0 +1,72 @@
---
{
"title": "Meta Info Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Meta Info Action
## Request
`GET /api/meta/namespaces/<ns>/databases`
`GET /api/meta/namespaces/<ns>/databases/<db>/tables`
`GET /api/meta/namespaces/<ns>/databases/<db>/tables/<tbl>/schema`
## Description
获取集群内的元数据信息,包括数据库列表、表列表以及表结构等。
## Path parameters
* `ns`
指定集群名。
* `db`
指定数据库。
* `tbl`
指定数据表。
## Query parameters
## Request body
## Response
```
{
"msg":"success",
"code":0,
"data":["数据库列表" / "数据表列表" /"表结构"],
"count":0
}
```

View File

@ -1,6 +1,6 @@
---
{
"title": "SHOW DATA",
"title": "Metrics Action",
"language": "zh-CN"
}
---
@ -24,12 +24,25 @@ specific language governing permissions and limitations
under the License.
-->
# SHOW DATA
获取当前集群占用的总空间大小
# Metrics Action
```
curl -X GET http://fe_host:fe_http_port/api/show_data
```
## Request
`GET /api/metrics`
## Description
获取doris metrics信息。
## Path parameters
## Query parameters
## Request body
返回值就是集群的总数据大小

View File

@ -33,6 +33,92 @@ under the License.
## Description
用于获取指定 query id 的 query profile
如果query_id不存在, 直接返回404 NOT FOUND错误
如果query_id存在,返回下列文本的profile:
```
Query:
Summary:
- Query ID: a0a9259df9844029-845331577440a3bd
- Start Time: 2020-06-15 14:10:05
- End Time: 2020-06-15 14:10:05
- Total: 8ms
- Query Type: Query
- Query State: EOF
- Doris Version: trunk
- User: root
- Default Db: default_cluster:test
- Sql Statement: select * from table1
Execution Profile a0a9259df9844029-845331577440a3bd:(Active: 7.315ms, % non-child: 100.00%)
Fragment 0:
Instance a0a9259df9844029-845331577440a3be (host=TNetworkAddress(hostname:172.26.108.176, port:9560)):(Active: 1.523ms, % non-child: 0.24%)
- MemoryLimit: 2.00 GB
- PeakUsedReservation: 0.00
- PeakMemoryUsage: 72.00 KB
- RowsProduced: 5
- AverageThreadTokens: 0.00
- PeakReservation: 0.00
BlockMgr:
- BlocksCreated: 0
- BlockWritesOutstanding: 0
- BytesWritten: 0.00
- TotalEncryptionTime: 0ns
- BufferedPins: 0
- TotalReadBlockTime: 0ns
- TotalBufferWaitTime: 0ns
- BlocksRecycled: 0
- TotalIntegrityCheckTime: 0ns
- MaxBlockSize: 8.00 MB
DataBufferSender (dst_fragment_instance_id=a0a9259df9844029-845331577440a3be):
- AppendBatchTime: 9.23us
- ResultRendTime: 956ns
- TupleConvertTime: 5.735us
- NumSentRows: 5
OLAP_SCAN_NODE (id=0):(Active: 1.506ms, % non-child: 20.59%)
- TotalRawReadTime: 0ns
- CompressedBytesRead: 6.47 KB
- PeakMemoryUsage: 0.00
- RowsPushedCondFiltered: 0
- ScanRangesComplete: 0
- ScanTime: 25.195us
- BitmapIndexFilterTimer: 0ns
- BitmapIndexFilterCount: 0
- NumScanners: 65
- RowsStatsFiltered: 0
- VectorPredEvalTime: 0ns
- BlockSeekTime: 1.299ms
- RawRowsRead: 1.91K (1910)
- ScannerThreadsVoluntaryContextSwitches: 0
- RowsDelFiltered: 0
- IndexLoadTime: 911.104us
- NumDiskAccess: 1
- ScannerThreadsTotalWallClockTime: 0ns
- MaterializeTupleTime: 0ns
- ScannerThreadsUserTime: 0ns
- ScannerThreadsSysTime: 0ns
- TotalPagesNum: 0
- RowsReturnedRate: 3.319K /sec
- BlockLoadTime: 539.289us
- CachedPagesNum: 0
- BlocksLoad: 384
- UncompressedBytesRead: 0.00
- RowsBloomFilterFiltered: 0
- TabletCount : 1
- RowsReturned: 5
- ScannerThreadsInvoluntaryContextSwitches: 0
- DecompressorTimer: 0ns
- RowsVectorPredFiltered: 0
- ReaderInitTime: 6.498ms
- RowsRead: 5
- PerReadThreadRawHdfsThroughput: 0.0 /sec
- BlockFetchTime: 4.318ms
- ShowHintsTime: 0ns
- TotalReadThroughput: 0.0 /sec
- IOTimer: 1.154ms
- BytesRead: 48.49 KB
- BlockConvertTime: 97.539us
- BlockSeekCount: 0
```
## Path parameters

View File

@ -0,0 +1,108 @@
---
{
"title": "Query Profile Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Query Profile Action
## Request
```
GET /rest/v1/query_profile/<query_id>
```
## Description
Query Profile Action 用于获取 Query 的 profile
## Path parameters
* `<query_id>`
可选参数。当不指定时,返回最新的 query 列表。当指定时,返回指定 query 的 profile。
## Query parameters
## Request body
## Response
* Not specify `<query_id>`
```
GET /rest/v1/query_profile/
{
"msg": "success",
"code": 0,
"data": {
"href_column": ["Query ID"],
"column_names": ["Query ID", "User", "Default Db", "Sql Statement", "Query Type", "Start Time", "End Time", "Total", "Query State"],
"rows": [{
"User": "root",
"__hrefPath": ["/query_profile/d73a8a0b004f4b2f-b4829306441913da"],
"Query Type": "Query",
"Total": "5ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "d73a8a0b004f4b2f-b4829306441913da",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}, {
"User": "root",
"__hrefPath": ["/query_profile/fd706dd066824c21-9d1a63af9f5cb50c"],
"Query Type": "Query",
"Total": "6ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "fd706dd066824c21-9d1a63af9f5cb50c",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}]
},
"count": 3
}
```
The returned result is the same as `System Action`, which is a table description.
* Specify `<query_id>`
```
GET /rest/v1/query_profile/<query_id>
{
"msg": "success",
"code": 0,
"data": "Query:</br>&nbsp;&nbsp;&nbsp;&nbsp;Summary:</br>...",
"count": 0
}
```
`data` is the text content of the profile.

View File

@ -28,81 +28,449 @@ under the License.
## Request
`GET /rest/v2/manager/query/query_info`
`GET /rest/v2/manager/query/trace/{trace_id}`
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
`GET /rest/v2/manager/query/profile/graph/{query_id}`
`GET /rest/v2/manager/query/profile/json/{query_id}`
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
`GET /rest/v2/manager/query/current_queries`
`GET /rest/v2/manager/query/kill/{query_id}`
## 获取查询信息
`GET /rest/v2/manager/query/query_info`
### Description
可获取集群所有 fe 节点 select 查询信息。
### Query parameters
* `query_id`
可选,指定返回查询的queryID, 默认返回所有查询的信息。
* `search`
可选,指定返回包含字符串的查询信息,目前仅进行字符串匹配。
* `is_all_node`
可选,若为 true 则返回所有fe节点的查询信息,若为 false 则返回当前fe节点的查询信息。默认为true。
### Response
```
GET /rest/v1/query_profile/<query_id>
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
...
]
]
},
"count": 0
}
```
## Description
<version since="1.2">
Query Profile Action 用于获取 Query 的 profile
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query
</version>
### Examples
```
GET /rest/v2/manager/query/query_info
{
"msg": "success",
"code": 0,
"data": {
"column_names": [
"Query ID",
"FE节点",
"查询用户",
"执行数据库",
"Sql",
"查询类型",
"开始时间",
"结束时间",
"执行时长",
"状态"
],
"rows": [
[
"d7c93d9275334c35-9e6ac5f295a7134b",
"127.0.0.1:8030",
"root",
"default_cluster:testdb",
"select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id",
"Query",
"2021-07-29 16:59:12",
"2021-07-29 16:59:12",
"109ms",
"EOF"
]
]
},
"count": 0
}
```
## 通过 Trace Id 获取 Query Id
`GET /rest/v2/manager/query/trace_id/{trace_id}`
### Description
通过 Trace Id 获取 Query Id.
在执行一个 Query 前,先设置一个唯一的 trace id:
`set set session_context="trace_id:your_trace_id";`
在同一个 Session 链接内执行 Query 后,可以通过 trace id 获取 query id。
## Path parameters
### Path parameters
* `<query_id>`
* `{trace_id}`
可选参数。当不指定时,返回最新的 query 列表。当指定时,返回指定 query 的 profile。
用户设置的 trace id.
## Query parameters
### Query parameters
### Response
## Request body
```
{
"msg": "success",
"code": 0,
"data": "fb1d9737de914af1-a498d5c5dec638d3",
"count": 0
}
```
<version since="1.2">
## Response
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 trace id 不存在或无权限,则返回 Bad Request:
* 不指定 `<query_id>`
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## 获取指定查询的sql和文本profile
`GET /rest/v2/manager/query/sql/{query_id}`
`GET /rest/v2/manager/query/profile/text/{query_id}`
### Description
用于获取指定query id的sql和profile文本。
### Path parameters
* `query_id`
query id。
### Query parameters
* `is_all_node`
可选,若为 true 则在所有fe节点中查询指定query id的信息,若为 false 则在当前连接的fe节点中查询指定query id的信息。默认为true。
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"sql": ""
},
"count": 0
}
```
```
{
"msg": "success",
"code": 0,
"data": {
"profile": ""
},
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 query id 不存在或无权限,则返回 Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
### Examples
1. 获取 sql:
```
GET /rest/v1/query_profile/
GET /rest/v2/manager/query/sql/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": {
"href_column": ["Query ID"],
"column_names": ["Query ID", "User", "Default Db", "Sql Statement", "Query Type", "Start Time", "End Time", "Total", "Query State"],
"rows": [{
"User": "root",
"__hrefPath": ["/query_profile/d73a8a0b004f4b2f-b4829306441913da"],
"Query Type": "Query",
"Total": "5ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "d73a8a0b004f4b2f-b4829306441913da",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}, {
"User": "root",
"__hrefPath": ["/query_profile/fd706dd066824c21-9d1a63af9f5cb50c"],
"Query Type": "Query",
"Total": "6ms",
"Default Db": "default_cluster:db1",
"Sql Statement": "select * from tbl1",
"Query ID": "fd706dd066824c21-9d1a63af9f5cb50c",
"Start Time": "2020-09-03 10:07:54",
"Query State": "EOF",
"End Time": "2020-09-03 10:07:54"
}]
},
"count": 3
"msg": "success",
"code": 0,
"data": {
"sql": "select c.id, c.name, p.age, p.phone, c.date, c.cost from cost c join people p on c.id = p.id where p.age > 20 order by c.id"
},
"count": 0
}
```
## 获取指定查询fragment和instance信息
`GET /rest/v2/manager/query/profile/fragments/{query_id}`
### Description
用于获取指定query id的fragment名称,instance id和执行时长。
返回结果同 `System Action`,是一个表格的描述。
### Path parameters
* `query_id`
query id。
### Query parameters
* `is_all_node`
可选,若为 true 则在所有fe节点中查询指定query id的信息,若为 false 则在当前连接的fe节点中查询指定query id的信息。默认为true。
### Response
```
{
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "",
"time": "",
"instance_id": {
"": ""
}
}
],
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 query id 不存在或无权限,则返回 Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
* 指定 `<query_id>`
### Examples
```
GET /rest/v1/query_profile/<query_id>
GET /rest/v2/manager/query/profile/fragments/d7c93d9275334c35-9e6ac5f295a7134b
Response:
{
"msg": "success",
"code": 0,
"data": "Query:</br>&nbsp;&nbsp;&nbsp;&nbsp;Summary:</br>...",
"count": 0
"msg": "success",
"code": 0,
"data": [
{
"fragment_id": "0",
"time": "36.169ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134e": "36.169ms"
}
},
{
"fragment_id": "1",
"time": "20.710ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134c": "20.710ms"
}
},
{
"fragment_id": "2",
"time": "7.83ms",
"instance_id": {
"d7c93d9275334c35-9e6ac5f295a7134d": "7.83ms"
}
}
],
"count": 0
}
```
## 获取指定query id树状profile信息
`GET /rest/v2/manager/query/profile/graph/{query_id}`
### Description
获取指定query id树状profile信息,同 `show query profile` 指令。
`data` 为 profile 的文本内容。
### Path parameters
* `query_id`
query id。
### Query parameters
* `fragment_id` 和 `instance_id`
可选,这两个参数需同时指定或同时不指定。
同时不指定则返回profile 简易树形图,相当于`show query profile '/query_id'`;
同时指定则返回指定instance详细profile树形图,相当于`show query profile '/query_id/fragment_id/instance_id'`.
* `is_all_node`
可选,若为 true 则在所有fe节点中查询指定query id的信息,若为 false 则在当前连接的fe节点中查询指定query id的信息。默认为true。
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"graph":""
},
"count": 0
}
```
<version since="1.2">
Admin 和 Root 用户可以查看所有 Query。普通用户仅能查看自己发送的 Query。若指定 query id 不存在或无权限,则返回 Bad Request:
```
{
"msg": "Bad Request",
"code": 403,
"data": "error messages",
"count": 0
}
```
</version>
## 正在执行的query
`GET /rest/v2/manager/query/current_queries`
### Description
同 `show proc "/current_query_stmts"`,返回当前正在执行的 query
### Path parameters
### Query parameters
* `is_all_node`
可选,若为 true 则返回所有FE节点当前正在执行的 query 信息。默认为 true。
### Response
```
{
"msg": "success",
"code": 0,
"data": {
"columnNames": ["Frontend", "QueryId", "ConnectionId", "Database", "User", "ExecTime", "SqlHash", "Statement"],
"rows": [
["172.19.0.3", "108e47ab438a4560-ab1651d16c036491", "2", "", "root", "6074", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"],
["172.19.0.11", "3606cad4e34b49c6-867bf6862cacc645", "3", "", "root", "9306", "1a35f62f4b14b9d7961b057b77c3102f", "select sleep(60)"]
]
},
"count": 0
}
```
## 取消query
`POST /rest/v2/manager/query/kill/{query_id}`
### Description
取消执行连接中正在执行的 query
### Path parameters
* `{query_id}`
query id. 你可以通过 trace_id 接口,获取 query id。
### Query parameters
### Response
```
{
"msg": "success",
"code": 0,
"data": null,
"count": 0
}
```

View File

@ -0,0 +1,58 @@
---
{
"title": "Statistic Action",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Statistic Action
## Request
`GET /rest/v2/api/cluster_overview`
## Description
获取集群统计信息、库表数量等。
## Path parameters
## Query parameters
## Request body
## Response
```
{
"msg":"success",
"code":0,
"data":{"diskOccupancy":0,"remainDisk":5701197971457,"feCount":1,"tblCount":27,"beCount":1,"dbCount":2},
"count":0
}
```

View File

@ -1,59 +0,0 @@
---
{
"title": "GET LABEL STATE",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# GET LABEL STATE
## description
NAME:
get_load_state: get load's state by label
SYNOPSIS
curl -u user:passwd http://host:port/api/{db}/get_load_state?label=xxx
DESCRIPTION
该命令用于查看一个Label对应的事务状态
RETURN VALUES
执行完毕后,会以Json格式返回这次导入的相关内容。当前包括以下字段
Label:本次导入的 label,如果没有指定,则为一个 uuid。
Status:此命令是否成功执行,Success表示成功执行
Message: 具体的执行信息
State: 只有在Status为Success时才有意义
UNKNOWN: 没有找到对应的Label
PREPARE: 对应的事务已经prepare,但尚未提交
COMMITTED: 事务已经提交,不能被cancel
VISIBLE: 事务提交,并且数据可见,不能被cancel
ABORTED: 事务已经被ROLLBACK,导入已经失败。
ERRORS
## example
1. 获得testDb, testLabel的状态
curl -u root http://host:port/api/testDb/get_load_state?label=testLabel
## keyword
GET, LOAD, STATE

View File

@ -1,120 +0,0 @@
---
{
"title": "PROFILE",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# PROFILE
通过query_id获取query profile
```
curl -X GET http://fe_host:fe_http_port/api/profile?query_id=123
```
如果query_id不存在, 直接返回404 NOT FOUND错误
如果query_id存在,返回下列文本的profile
```
Query:
Summary:
- Query ID: a0a9259df9844029-845331577440a3bd
- Start Time: 2020-06-15 14:10:05
- End Time: 2020-06-15 14:10:05
- Total: 8ms
- Query Type: Query
- Query State: EOF
- Doris Version: trunk
- User: root
- Default Db: default_cluster:test
- Sql Statement: select * from table1
Execution Profile a0a9259df9844029-845331577440a3bd:(Active: 7.315ms, % non-child: 100.00%)
Fragment 0:
Instance a0a9259df9844029-845331577440a3be (host=TNetworkAddress(hostname:172.26.108.176, port:9560)):(Active: 1.523ms, % non-child: 0.24%)
- MemoryLimit: 2.00 GB
- PeakUsedReservation: 0.00
- PeakMemoryUsage: 72.00 KB
- RowsProduced: 5
- AverageThreadTokens: 0.00
- PeakReservation: 0.00
BlockMgr:
- BlocksCreated: 0
- BlockWritesOutstanding: 0
- BytesWritten: 0.00
- TotalEncryptionTime: 0ns
- BufferedPins: 0
- TotalReadBlockTime: 0ns
- TotalBufferWaitTime: 0ns
- BlocksRecycled: 0
- TotalIntegrityCheckTime: 0ns
- MaxBlockSize: 8.00 MB
DataBufferSender (dst_fragment_instance_id=a0a9259df9844029-845331577440a3be):
- AppendBatchTime: 9.23us
- ResultRendTime: 956ns
- TupleConvertTime: 5.735us
- NumSentRows: 5
OLAP_SCAN_NODE (id=0):(Active: 1.506ms, % non-child: 20.59%)
- TotalRawReadTime: 0ns
- CompressedBytesRead: 6.47 KB
- PeakMemoryUsage: 0.00
- RowsPushedCondFiltered: 0
- ScanRangesComplete: 0
- ScanTime: 25.195us
- BitmapIndexFilterTimer: 0ns
- BitmapIndexFilterCount: 0
- NumScanners: 65
- RowsStatsFiltered: 0
- VectorPredEvalTime: 0ns
- BlockSeekTime: 1.299ms
- RawRowsRead: 1.91K (1910)
- ScannerThreadsVoluntaryContextSwitches: 0
- RowsDelFiltered: 0
- IndexLoadTime: 911.104us
- NumDiskAccess: 1
- ScannerThreadsTotalWallClockTime: 0ns
- MaterializeTupleTime: 0ns
- ScannerThreadsUserTime: 0ns
- ScannerThreadsSysTime: 0ns
- TotalPagesNum: 0
- RowsReturnedRate: 3.319K /sec
- BlockLoadTime: 539.289us
- CachedPagesNum: 0
- BlocksLoad: 384
- UncompressedBytesRead: 0.00
- RowsBloomFilterFiltered: 0
- TabletCount : 1
- RowsReturned: 5
- ScannerThreadsInvoluntaryContextSwitches: 0
- DecompressorTimer: 0ns
- RowsVectorPredFiltered: 0
- ReaderInitTime: 6.498ms
- RowsRead: 5
- PerReadThreadRawHdfsThroughput: 0.0 /sec
- BlockFetchTime: 4.318ms
- ShowHintsTime: 0ns
- TotalReadThroughput: 0.0 /sec
- IOTimer: 1.154ms
- BytesRead: 48.49 KB
- BlockConvertTime: 97.539us
- BlockSeekCount: 0
```

View File

@ -1,59 +0,0 @@
---
{
"title": "QUERY DETAIL",
"language": "zh-CN"
}
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# QUERY DETAIL
从FE获取所有的查询细节,获取关于查询执行的相关信息。
FE会返回在event_time之后的查询细节,其中event_time单位会精确到毫秒。
```
curl -X GET http://fe_host:fe_http_port/api/query_detail?event_time=1592054515284
```
查询信息会以JSON格式返回。
```
[
{
"eventTime": 1592201405063,
"queryId": "a0a9259df9844029-845331577440a3bd",
"startTime": 1592201405055,
"endTime": 1592201405063,
"latency": 8,
"state": "FINISHED",
"database": "test",
"sql": "select * from table1"
},
{
"eventTime": 1592201420842,
"queryId": "21cd79c3e1634e8a-bdac090c7e7bcc36",
"startTime": 1592201420834,
"endTime": 1592201420842,
"latency": 8,
"state": "FINISHED",
"database": "test",
"sql": "select * from table1"
}
]