Enabling or Disabling SQL Explorer and Slow Query Log
Function
SQL Explorer can be enabled and disabled. After this function is enabled, the instance performance loss rate is within 5% and DAS stores all SQL statement logs for analysis. You can set the retention period of SQL explorer data. After the retention period expires, the data is automatically deleted. If not specified, the data is retained for seven days. Slow Query Log can be enabled and disabled. After this function is enabled, DAS stores slow query logs for analysis. You can set the retention period of slow query logs. After the retention period expires, the data is automatically deleted. If not specified, the data is retained for seven days. This function is available only for paid instances.
URI
POST /v3/{project_id}/instances/{instance_id}/sql/switch
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. To obtain this value, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Instance ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. |
X-Language |
No |
String |
Request language type. Enumerated values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
String |
Switch type. The value can be DAS SQL Explorer or DAS Slow Query Log. |
status |
Yes |
Integer |
Status. The value can be 0 (disabled) or 1 (enabled). |
datastore_type |
Yes |
String |
Database type. SQL Explorer is supported for MySQL and TaurusDB. Slow Query Log is supported for MySQL, TaurusDB, and PostgreSQL. |
retention_days |
No |
Long |
SQL data retention period (days). The default value is 7. The maximum retention period is 30 days. Data will be automatically deleted after time expires. If you want to retain the data for more than 30 days, perform operations on the DAS console. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
status |
String |
Function status. The value can be Enabled, Disabled, or Switching. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum length: 8 characters Maximum length: 36 characters |
error_msg |
String |
Error message. Minimum length: 2 characters Maximum length: 512 characters |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum length: 8 characters Maximum length: 36 characters |
error_msg |
String |
Error message. Minimum length: 2 characters Maximum length: 512 characters |
Example Request
Enabling SQL Explorer
POST https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/instances/da304cd5bbb944de828759bc7be3d3fein01/sql/switch { "type" : "DAS SQL Explorer", "status" : 1, "datastore_type" : "MySQL", "retention_days" : 8 }
Example Response
Status code: 200
Response body
{ "status" : "Enabled" }
Status Codes
Status Code |
Description |
---|---|
200 |
Response body. |
400 |
Client error. |
500 |
Server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot