Configure an Alibaba Cloud External Collection Source
Alibaba Cloud external collection sources are used to collect slow logs from Alibaba Cloud managed databases. The current support scope includes Alibaba Cloud RDS MySQL, RDS PostgreSQL, PolarDB for MySQL, and PolarDB for PostgreSQL.
Prerequisites
- You have created or joined an organization, and this organization has subscribed to either DevOps Pro or DevOps Enterprise. Please ensure that your annual or monthly subscription is still active. For more information, please refer to Manage Organizations.
- Your current account has switched to the target organization. For more information, please refer to Switching to an Organization.
- Alibaba Cloud access credentials have already been configured in NineData. For more information, see Configure Cloud Vendor Access Credentials.
- The target Alibaba Cloud data source has already been added. It is recommended to create or bind the instance through the Alibaba Cloud entry.
- You have confirmed the target instance or cluster region and the instance ID or cluster ID.
- Slow logging is enabled on the target instance, and the cloud account has read-only access to the target instance or cluster and SQL log archive/export permissions.
Permission Requirements
Grant the following system policy to the Alibaba Cloud RAM user, user group, or role according to the instance type.
| Instance Type | Minimum System Policy |
|---|---|
| RDS | AliyunRDSReadOnlyWithSQLLogArchiveAccess |
| PolarDB | AliyunPolardbReadOnlyWithSQLLogArchiveAccess |
RDS or PolarDB read-only policies alone may not allow SQL log archive data to be read. If you use a custom RAM policy, make sure it covers the corresponding product's read-only permissions and SQL log archive/export permissions.
Step 1: Create an Alibaba Cloud External Collection Source
Log in to the NineData Console.
In the left navigation pane, click DevOps > Slow Query.
On the top tab bar, click External Collection Source.
Click Create External Collection Source, then complete the following configuration in the drawer.
Parameter Description Source Type Select Alibaba Cloud. Cloud Access Credential Select the configured Alibaba Cloud access credential. Source Name Enter a custom source name. Description Optional. Enter a description for this source. Click OK to create the source.
Step 2: Bind the Source and Enable Collection
Return to the Slow Query tab, find the target Alibaba Cloud data source, and turn on the switch in the Slow Query column.
In the dialog, select External Source Collection, then complete the following configuration.
Parameter Description External Collection Source Select the Alibaba Cloud external collection source you created. Source Data Source Unique Identifier Enter key-value pairs based on the instance type. RDS instances usually use DBInstanceIdandRegionId; PolarDB clusters usually useDBClusterIdandRegionId.Collection Frequency Select the slow log collection frequency. Enter identifiers based on the instance type.
Instance Type Key Description RDS DBInstanceIdAlibaba Cloud RDS instance ID. RDS RegionIdAlibaba Cloud region ID, for example cn-hangzhou.PolarDB DBClusterIdAlibaba Cloud PolarDB cluster ID. PolarDB RegionIdAlibaba Cloud region ID, for example cn-hangzhou.Click OK to enable collection.
Step 3: Confirm Collection Results
Wait for at least one collection cycle, then open the Slow Query Details page of the target data source. Adjust the time range and check the slow log list, Top SQL, and trend chart to confirm whether slow log records have been written to NineData.
The slow query detail page displays records from a maximum time range of 3 days. If the target instance has no new slow logs, the query result is empty.
FAQ
| Symptom | Recommended Check |
|---|---|
| Cloud access credential not found | Create Alibaba Cloud access credentials in NineData first. |
| Region parameter is missing | Fill in RegionId and make sure it matches the target instance or cluster. |
| Instance ID or cluster ID is missing | Use DBInstanceId for RDS and DBClusterId for PolarDB. |
| Cloud vendor client connection failed | Check whether the data source was created through the Alibaba Cloud entry. If not, confirm that the connection method, region, and identifier match the Alibaba Cloud console. |
| Collection result is empty | Make sure slow logging is enabled on the target instance and slow queries were generated within the selected time range. |