> For the complete documentation index, see [llms.txt](https://docs.datasentinel.io/manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datasentinel.io/manual/guides/readme/monitor-high-availability-clusters.md).

# Monitor High-Availability Clusters

<div data-with-frame="true"><figure><img src="/files/qiwnfcaqdoZ1PEsuxBhT" alt="Monitor High-Availability Clusters"><figcaption></figcaption></figure></div>

This guide explains how Datasentinel detects and manages HA clusters, how instances are grouped, and how to analyze workload and activity in highly available PostgreSQL environments.

## HA Cluster Detection

Datasentinel automatically detects the role of each PostgreSQL instance, identifying primary instances and read-only replicas based on runtime characteristics.

{% hint style="info" %}
If a failover occurs, Datasentinel updates instance roles automatically to reflect the new cluster topology.
{% endhint %}

## Using Tags with HA Clusters

[**Tags**](/manual/guides/readme/organize-content-using-tags.md) can be applied to PostgreSQL instances that belong to an HA cluster.

When instances share the same tag (for example, `ha_cluster=sales-app`), you can:

* Analyze the consolidated workload of the cluster
* Apply[ **role-based access control (RBAC)**](/manual/guides/readme/manage-users-and-role-based-access.md) at the cluster level
* [**Filter dashboards**](/manual/guides/readme/organize-content-using-tags.md) and reports by cluster or application

Tags combined with HA awareness provide powerful grouping and access-control capabilities.

## Consolidated Cluster View

Datasentinel provides a **cluster-level view** that aggregates activity across all instances in the HA cluster.

This allows you to:

* Analyze total workload across the cluster
* Compare activity between primary and replicas
* Identify load distribution and imbalance

Cluster-level analysis removes the need to inspect each instance individually.

<div data-with-frame="true"><figure><img src="/files/JfSiEkURRCrlPmjL5YAR" alt=""><figcaption></figcaption></figure></div>

## Workload Analysis Across HA Clusters

Using Datasentinel dashboards and analysis modules, you can:

* View [**Top Queries**](/manual/features/key-features/top-queries.md) across the entire cluster
* Analyze [**Session Activity**](/manual/features/key-features/session-history.md) on primary and replicas
* Identify queries executed on replicas only
* Detect replication-aware workload patterns

This is particularly useful for understanding how applications leverage read replicas.

<div data-with-frame="true"><figure><img src="/files/c6wawDtqpQIZoiH0XL01" alt=""><figcaption></figcaption></figure></div>

## Viewing Replication Statistics

Datasentinel collects and logs replication statistics for PostgreSQL read replicas, providing clear visibility into replication health.

For each replica, Datasentinel allows you to:

* View the **WAL delta size**, representing the amount of data remaining to be replicated
* Monitor **replication delay**, indicating how far replicas lag behind the primary instance

<div data-with-frame="true"><figure><img src="/files/Ycx7XmNJBJz32KgvF4tc" alt=""><figcaption></figcaption></figure></div>

## Common Use Cases

Typical HA cluster monitoring scenarios include:

* Analyzing total workload across primary and replicas
* Verifying that read traffic is correctly routed to replicas
* Comparing query patterns between instances
* Monitoring cluster behavior during failover events

## Best Practices

* Use consistent tags across all instances in an HA cluster
* Combine cluster-level analysis with instance-level dashboards
* Review workload distribution regularly
* Use tags to control access to entire clusters via RBAC

{% hint style="info" %}
Datasentinel is compatible with read replicas from managed PostgreSQL services offered by major public cloud providers, including Amazon RDS, Microsoft Azure, and Google Cloud.
{% endhint %}

## Where to go next

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><i class="fa-tag" style="color:$primary;">:tag:</i></h4></td><td><strong>Organize Content using Tags</strong>: the shared cluster tag is what unlocks consolidated HA analysis.</td><td><a href="/pages/jdy0zIUnjZHb9XwBGH0Y">/pages/jdy0zIUnjZHb9XwBGH0Y</a></td></tr><tr><td><h4><i class="fa-users" style="color:$primary;">:users:</i></h4></td><td><strong>Manage Users and Role-Based Access</strong>: grant access to an entire cluster (primary plus replicas) through a single role.</td><td><a href="/pages/M5MUBWa2Y2eRROXypHwm">/pages/M5MUBWa2Y2eRROXypHwm</a></td></tr><tr><td><h4><i class="fa-cloud" style="color:$primary;">:cloud:</i></h4></td><td><strong>Monitor Cloud-Managed Instances</strong>: apply the same HA recipe to RDS, Azure, and Cloud SQL replica deployments.</td><td><a href="/pages/aGpRhzYSyd7klXa01uYC">/pages/aGpRhzYSyd7klXa01uYC</a></td></tr><tr><td><h4><i class="fa-rocket" style="color:$primary;">:rocket:</i></h4></td><td><strong>Onboard Your First PostgreSQL Cluster</strong>: get each individual instance monitored before grouping them into an HA cluster.</td><td><a href="/pages/A9sFriZivMT20vNkYp0w">/pages/A9sFriZivMT20vNkYp0w</a></td></tr></tbody></table>

## Conclusion

Datasentinel provides clear visibility into high-availability PostgreSQL environments by automatically detecting primary and replica roles and enabling consolidated activity analysis across instances.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.datasentinel.io/manual/guides/readme/monitor-high-availability-clusters.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
