Alibaba Cloud PolarDB MySQL¶
Alibaba Cloud PolarDB MySQL Metrics Display, including CPU usage, memory hit rate, network traffic, number of connections, QPS, TPS, read-only node latency, etc.
Configuration¶
Install Func¶
It is recommended to activate the Guance integration - extension - hosted Func
If you deploy Func on your own, refer to Self-deployed Func
Activation Script¶
Tip: Please prepare an Alibaba Cloud AK that meets the requirements in advance (for simplicity, you can directly grant global read-only permission
ReadOnlyAccess
)
Hosted Activation Script¶
- Log in to Guance console
- Click on the 【Integration】 menu and select 【Cloud Account Management】
- Click 【Add Cloud Account】, choose 【Alibaba Cloud】, fill in the required information on the interface; if cloud account information has been configured before, skip this step
- Click 【Test】, after a successful test click 【Save】, if the test fails, check whether the related configuration information is correct and retest
- In the 【Cloud Account Management】 list, you can see the added cloud accounts, click on the corresponding cloud account to enter the details page
- Click the 【Integration】 button on the cloud account details page, under the
Not Installed
list, findAlibaba Cloud PolarDB MYSQL
, click the 【Install】 button, and install via the pop-up installation interface.
Manual Activation Script¶
-
Log in to the Func console, click 【Script Market】, enter the official script market, search for
guance_aliyun_polardb
-
After clicking 【Install】, input the corresponding parameters: Alibaba Cloud AK ID, AK Secret, and account name.
-
Click 【Deploy Startup Script】, the system will automatically create a
Startup
script set and configure the corresponding startup script automatically. -
After enabling, you can see the corresponding automatic trigger configuration in 「Management / Automatic Trigger Configuration」. Click 【Execute】 to immediately execute once without waiting for the scheduled time. Wait a moment, then view the task execution records and corresponding logs. `, click the 【Install】 button, and install via the pop-up installation interface.
We default to collecting some configurations, see the metrics section for more details.
Customize Cloud Object Metrics Configuration
Verification¶
- In 「Management/Automatic Trigger Configuration」, confirm whether the corresponding tasks have the corresponding automatic trigger configuration, while checking the task records and logs for any anomalies.
- In Guance, 「Infrastructure / Custom」 check if asset information exists.
- In Guance, 「Metrics」 check if there are corresponding monitoring data.
Metrics¶
After configuring Alibaba Cloud - Cloud Monitoring, the default metric set is as follows. You can collect more metrics through configuration. Alibaba Cloud Cloud Monitoring Metric Details
Metric Id | Metric Name | Dimensions | Statistics | Unit |
---|---|---|---|---|
cluster_active_sessions |
Active connection count | userId,clusterId,nodeId | Average | count |
cluster_blktag_utilization |
blktag utilization | userId,clusterId | Average | % |
cluster_connection_utilization |
Connection utilization | userId,clusterId,nodeId | Average,Maximum,Minimum | % |
cluster_cpu_utilization |
CPU utilization | userId,clusterId,nodeId | Average | % |
cluster_data_io |
Storage engine IO throughput per second | userId,clusterId,nodeId | Average | KB |
cluster_data_iops |
Storage engine IO operations per second | userId,clusterId,nodeId | Average | countSecond |
cluster_direntry_utilization |
direntry utilization | userId,clusterId | Average | % |
cluster_disk_utilization |
Disk utilization | userId,clusterId | Average | % |
cluster_imci_datasize |
IMCI node columnar index storage size | userId,clusterId,nodeId | Average | MB |
cluster_imci_exememusage |
IMCI executor used memory size | userId,clusterId,nodeId | Average | Byte |
cluster_imci_stmtsexepersec |
IMCI SQL queries per second | userId,clusterId,nodeId | Average | count/s |
cluster_imci_stmtsinqueue |
IMCI SQL queries in scheduling queue | userId,clusterId,nodeId | Average | count |
cluster_imci_tmpfileusedsize |
IMCI executor temporary table size | userId,clusterId,nodeId | Average | Byte |
cluster_inode_utilization |
inode utilization | userId,clusterId | Average | % |
cluster_input_traffic |
Network input traffic per second | userId,clusterId,nodeId | Average,Maximum,Minimum | KByte/s |
cluster_iops |
IO operations per second | userId,clusterId,nodeId | Average | countSecond |
cluster_iops_usage |
IOPS utilization | userId,clusterId,nodeId | Average,Maximum,Minimum | % |
cluster_mem_hit_ratio |
Memory hit ratio | userId,clusterId,nodeId | Average | % |
cluster_memory_utilization |
Memory utilization | userId,clusterId,nodeId | Average | % |
cluster_mps |
Data operations per second | userId,clusterId,instanceId | Average,Maximum,Minimum | countSecond |
cluster_output_traffic |
Network output traffic per second | userId,clusterId,nodeId | Average,Maximum,Minimum | KByte/s |
cluster_proxy_cpu_utilization |
ProxyCPU utilization | userId,clusterId | Average,Maximum,Minimum | % |
cluster_qps |
Queries per second | userId,clusterId,nodeId | Average | count |
cluster_redo_write_rate |
Redo log write rate | userId,clusterId,nodeId | Average | Byte/s |
cluster_replica_lag |
Read-only node replication delay | userId,clusterId,instanceId | Average,Minimum,Maximum | seconds |
cluster_slow_queries_ps |
Slow queries per second | userId,clusterId,nodeId | Average | countS |
cluster_total_session |
Total current connections | userId,clusterId,nodeId | Average,Maximum,Minimum | count |
cluster_tps |
Transactions per second | userId,clusterId,nodeId | Average | countS |
Objects¶
The collected Alibaba Cloud PolarDB MySQL object data structure can be viewed from 「Infrastructure - Custom」.
{
"measurement": "aliyun_polardb",
"tags": {
"name" : "pc-xxxx",
"RegionId" : "cn-hangzhou",
"VpcId" : "vpc-xxxx",
"DBNodeNumber" : "2",
"PayType" : "Postpaid",
"DBType" : "MySQL",
"LockMode" : "Unlock",
"DBVersion" : "8.0",
"DBClusterId" : "pc-xxxx",
"DBClusterNetworkType": "VPC",
"ZoneId" : "cn-hangzhou-i",
"Engine" : "POLARDB",
"Category" : "Normal",
"DBClusterDescription": "pc-xxxx",
"DBNodeClass" : "polar.mysql.x4.medium"
},
"fields": {
"DBNodes" : "{JSON data of node list}",
"Database" : "[JSON data of database details]",
"ExpireTime": "",
"CreateTime": "2022-06-17T06:07:19Z",
"message" : "{JSON data of instance}"
}
}
Logs¶
Slow Query Statistics¶
Prerequisites¶
Note: The operation of this script depends on the collection of PolarDB instance objects. If the custom object collection for PolarDB is not configured, the slow log script cannot collect slow log data.
Installation Script¶
Based on the previous setup, you need to install a script for PolarDB Slow Query Statistics Log Collection
In 「Management / Script Market」, click and install the corresponding script package:
- 「Guance Integration (Alibaba Cloud - PolarDB Slow Query Statistics Log Collection)」(ID:
guance_aliyun_polardb_slowlog
)
After the data synchronization is normal, you can view the data in the 「Logs」 section of Guance.
An example of the reported data is as follows:
{
"measurement": "aliyun_polardb_slowlog",
"tags": {
"DBName" : "PolarDB_MySQL",
"DBNodeId": "pi-***************"
},
"fields": {
"CreateTime" : "2023-05-22Z",
"MaxExecutionTime" : 60,
"MaxLockTime" : 1,
"ParseMaxRowCount" : 1,
"ParseTotalRowCounts" : 2,
"ReturnMaxRowCount" : 3,
"ReturnTotalRowCounts": 1,
"SQLHASH" : "U2FsdGVkxxxx",
"SQLText" : "select id,name from tb_table",
"TotalExecutionCounts": 2,
"TotalExecutionTimes" : 2,
"TotalLockTimes" : 1,
"message" : "{Log JSON data}"
}
}
Some parameter descriptions are as follows:
Field | Type | Description |
---|---|---|
MaxExecutionTime |
Long | Execution duration (maximum), unit: seconds |
TotalExecutionTimes |
Long | Execution duration (total), unit: seconds |
TotalLockTimes |
Long | Lock duration (total), unit: seconds |
MaxLockTime |
Long | Lock duration (maximum), unit: seconds |
ReturnMaxRowCount |
Long | Returned SQL row count (maximum) |
ReturnTotalRowCounts |
Long | Returned SQL row count (total) |
ParseMaxRowCount |
Long | Parsed SQL row count (maximum) |
ParseTotalRowCounts |
Long | Parsed SQL row count (total) |
TotalExecutionCounts |
Long | Execution count (total) |
Note: Fields in
tags
andfields
may change with subsequent updates.Tip:
fields.message
is a JSON serialized string
Slow Query Details¶
Prerequisites¶
Note: The operation of this script depends on the collection of PolarDB instance objects. If the custom object collection for PolarDB is not configured, the slow log script cannot collect slow log data.
Installation Script¶
Based on the previous setup, you need to install a script for PolarDB Slow Query Details Log Collection
In 「Management / Script Market」, click and install the corresponding script package:
- 「Guance Integration (Alibaba Cloud - PolarDB Slow Query Details Log Collection)」(ID:
guance_aliyun_polardb_slowlog_record
)
After the data synchronization is normal, you can view the data in the 「Logs」 section of Guance.
Configuration Cloud Database PolarDB Slow Query Details
An example of the reported data is as follows:
{
"measurement": "aliyun_polardb_slowlog_record",
"tags": {
"DBName" : "PolarDB_MySQL",
"DBNodeId" : "pi-***************",
"HostAddress": "testdb[testdb] @ [100.**.**.242]"
},
"fields": {
"SQLText" : "select id,name from tb_table",
"ExecutionStartTime": "2021-04-07T03:47Z",
"QueryTimes" : 20,
"ReturnRowCounts" : 0,
"ParseRowCounts" : 0,
"LockTimes" : 0,
"QueryTimeMS" : 100,
"message" : "{Log JSON data}"
}
}
Some parameter descriptions are as follows:
Field | Type | Description |
---|---|---|
QueryTimes |
Long | SQL execution duration, unit in seconds |
QueryTimesMS |
Long | Query time, unit in milliseconds |
ReturnRowCounts |
Long | Returned rows |
ParseRowCounts |
Long | Parsed rows |
ExecutionStartTime |
String | SQL start execution time. Format YYYY-MM-DDThh:mmZ (UTC time) |
LockTimes |
Long | SQL lock duration, unit in seconds |
Note: Fields in
tags
andfields
may change with subsequent updates.Tip:
fields.message
is a JSON serialized string