

# Monitoring database cluster groups for Aurora

Monitor a database cluster group for Aurora, its [routing layer](databaseclustergroups-architecture.md), and its data movement through their metrics, logs, and events, and compare its [member clusters](databaseclustergroups-member-clusters.md) side by side. Monitoring works with routing enabled or disabled.

## Overview
<a name="databaseclustergroups-monitoring-overview"></a>

At the group level, you monitor three things:
+ **The group.** CloudWatch metrics that combine the member clusters' values, the group's audit logs, and the group's Amazon RDS events.
+ **The routing layer.** If you use routing, the routing layer's CloudWatch metrics and logs, its session list, and the metrics of the Amazon VPC endpoints that serve the [routing endpoint](databaseclustergroups-connecting.md).
+ **Data movement.** The progress of each [data movement job](databaseclustergroups-data-movement.md), in `move_info` (see [move\_info](databaseclustergroups-sysviews-move-info.md)), in the data movement logs, and in the group's Amazon RDS events.

Each member cluster stays a standard Aurora DB cluster, with its own metrics, logs, Performance Insights data, and events. Monitor it as you would any Aurora DB cluster; see [Monitoring metrics in an Amazon Aurora cluster](MonitoringAurora.md).

To tell whether added latency or an error comes from the routing layer or from one member cluster, use the following table to choose where to look first.


| Question | Tool | Where to read it | 
| --- | --- | --- | 
| Is a group metric high, and which member cluster drives it? | CloudWatch metrics | The group metrics, the routing layer metrics, and each member cluster's metrics. See [CloudWatch metrics for database cluster groups for Aurora](databaseclustergroups-metrics.md). | 
| What happened to a statement or a connection? | Amazon CloudWatch Logs | The routing layer's logs and the log groups of each member cluster. See [Logs for database cluster groups for Aurora](databaseclustergroups-logging.md). | 
| Which statements carry the load? | Performance Insights and Database Insights | Each DB instance of each member cluster. See [Monitoring member clusters side by side](#databaseclustergroups-monitoring-member-clusters-side-by-side). | 
| What is a session doing now? | SQL diagnostics | The routing layer's session list and each member cluster's own views. See [Routing layer metrics and signals](databaseclustergroups-metrics.md#databaseclustergroups-monitoring-the-router). | 
| What changed, and who changed it? | Amazon RDS events and audit logs | See [Amazon RDS events for database cluster groups for Aurora](databaseclustergroups-group-events.md) and [Auditing access and member cluster configuration](databaseclustergroups-auditing.md). | 

## Monitoring member clusters side by side
<a name="databaseclustergroups-monitoring-member-clusters-side-by-side"></a>

To compare member clusters, take the same reading on each one and put each member cluster in its own column.

**To monitor member clusters side by side**

1. List the member clusters with `describe-db-cluster-groups`. With routing enabled, you can also query `dbclustergroup_sys.member_cluster_mappings` at the routing endpoint (see [member\_cluster\_mappings](databaseclustergroups-sysviews-member-cluster-mappings.md)). Use each member cluster's alias in SQL at the routing endpoint, and its DB cluster identifier with the AWS CLI, CloudWatch, and Amazon CloudWatch Logs. For the parameters, see `DescribeDBClusterGroups` in the *Amazon RDS API Reference*.

   ```bash
   aws rds describe-db-cluster-groups --region {{REGION}} --db-cluster-group-identifier {{GROUP_IDENTIFIER}} \
     --query 'DBClusterGroups[0].DBClusterGroupMembers'
   ```

1. In CloudWatch, read the same metric, period, and statistic for each member cluster's `DBClusterIdentifier`, one column per member cluster.

1. In Amazon CloudWatch Logs, query each member cluster's log groups over the same time window, for example its error log or slow query log.

1. Open Performance Insights, or the Database Insights per-instance dashboard, on each member cluster's writer, and on its readers when they serve reads. Use the same time window on each.

1. On each member cluster, connect directly and run SQL diagnostics in a read-only session with a statement time limit.

   ```sql
   SET SESSION transaction_read_only = ON, max_execution_time = 60000,
               lock_wait_timeout = 5, innodb_lock_wait_timeout = 5;
   ```

   To count sessions, use `Threads_connected`, or count by connection source: a session that the routing layer opened carries the `_rds_connection_source` connect attribute in `performance_schema.session_connect_attrs`. For more information, see [Tracing a session or statement across the group](databaseclustergroups-trace-session.md).

When you compare the results:
+ **Don't average percentiles across member clusters.** The average or the maximum of the member clusters' p99 values isn't the group's p99, and a group average can hide one member cluster with high load.
+ **Split load by origin.** Separate routed sessions from direct ones. A batch job connected directly to one member cluster raises that member cluster's load without any routed traffic.
+ **Compare capacity settings, not current capacity.** For Aurora Serverless v2 member clusters, a difference in minimum or maximum capacity is a finding.

To find the cause of uneven load, including lock waits and long transactions on one member cluster, see [Troubleshooting uneven load across member clusters](databaseclustergroups-ts-uneven-load.md).

## Monitoring data movement
<a name="databaseclustergroups-monitoring-data-movement"></a>

Data movement jobs report their progress through `dbclustergroup_data_movement.move_info` at the routing endpoint, the data movement logs, and the group's Amazon RDS events, not through CloudWatch metrics. Because a job uses input and output on its source and target member clusters, watch their metrics while it runs. To read a job's progress, cut over, and cancel a job, see [Moving a collocation](databaseclustergroups-running-a-move.md).