Skip to content

docs: distributed topology through replica clusters - #5133

Merged
leonardoce merged 2 commits into
mainfrom
dev/5087
Jul 25, 2024
Merged

leonardoce merged 2 commits into
mainfrom
dev/5087

Conversation

@gbartolini

@gbartolini gbartolini commented Jul 22, 2024 •

Copy link
Copy Markdown
Contributor

Closes #5087

@gbartolini
gbartolini requested a review from jsilvela as a code owner July 22, 2024 17:22
@gbartolini
gbartolini requested a review from a team July 22, 2024 17:22
@gbartolini
gbartolini marked this pull request as draft July 22, 2024 17:22
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.22 labels Jul 22, 2024
@github-actions

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

3 similar comments
@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@gbartolini gbartolini added do not backport This PR must not be backported - it will be in the next minor release and removed backport-requested ◀️ This pull request should be backported to all supported releases release-1.22 labels Jul 23, 2024
@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

2 similar comments
@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@gbartolini
gbartolini marked this pull request as ready for review July 23, 2024 09:28
@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Comment thread docs/src/architecture.md Outdated
Comment on lines 113 to 119

@jsilvela jsilvela Jul 23, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph confuses me.
We start by saying
(1) that with only two data centers available, a sing Kubernetes cluster is the only way
And then in the end we say that the user must create two Kubernetes clusters in active/passive.
So, it seems, we go back on (1)

I think there are three different points:
1 - with two data centers in the same AZ, only a single k8s cluster is viable
2 - two data centers in separate AZs are not enough to create an HA K8s cluster
3 - if you do have two data centers in different AZs, then you have to create two K8s clusters

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read it fine:

  • if you have two DCs with low latency
  • you can't create a single K8s cluster that covers both, you'd need three DCs (AZs)
  • therefore, you must have two single AZ K8s clusters, an active one and a passive one

And the following hint explain that you may have taken the decision too early, before knowing the implications.

Although I would pluralise the beginning of the sentence. I think that it makes a bit clearer that the k8s clusters must be 2.

Suggested change
A single availability zone Kubernetes cluster is the only viable option when
only **two data centers** are available within reach of a low-latency
connection (typically in the same metropolitan area). Having only two zones
prevents the creation of a multi-availability zone Kubernetes cluster, which
requires a minimum of three zones. As a result, users must create two separate
Kubernetes clusters in an active/passive configuration, with the second cluster
primarily used for Disaster Recovery (see the [replica cluster feature](replica_cluster.md)).
Single availability zone Kubernetes clusters are the only viable option when
only **two data centers** are available within reach of a low-latency
connection (typically in the same metropolitan area). Having only two zones
prevents the creation of a multi-availability zone Kubernetes cluster, which
requires a minimum of three zones. As a result, users must create two separate
Kubernetes clusters in an active/passive configuration, with the second cluster
primarily used for Disaster Recovery (see the [replica cluster feature](replica_cluster.md)).

Comment thread docs/src/installation_upgrade.md Outdated
Comment on lines 281 to 283

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this is helpful. We add it here but then don't explain what these things mean, and while <CLUSTER_NAME> is something all CNPG users will be familiar with, what is meant by <SOURCE>?
So, I think it's better to say less here and refer earlier to the replica cluster document.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Although the change in the behaviour of enabled should be here, so a bit of context should remain.

Comment thread docs/src/installation_upgrade.md Outdated
Comment on lines 272 to 273

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if the externalClusters are not identical?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That it will be hell maintaining the clusters. Although nothing will force the sections to be identical, they could be managed by different operators, in different clusters.

We could "strongly suggest".

Comment thread docs/src/operator_capability_levels.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO "craft" is a bit rich.

Suggested change
Leverage replica clusters to craft [distributed database topologies](replica_cluster.md#distributed-topology)
Leverage replica clusters to create [distributed database topologies](replica_cluster.md#distributed-topology)

Comment thread docs/src/operator_capability_levels.md Outdated
Comment on lines 478 to 481

@jsilvela jsilvela Jul 23, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regions here is a bit overloaded. The replica switchover could conceivably be done in a single
k8s across data centers, and in any case using streaming.
So I think the point is "it can be done even without streaming replication", no?

Suggested change
This setup can efficiently operate across two or more regions, using only
object stores for replication, and guarantees a maximum RPO (Recovery Point
Objective) of 5 minutes. This advanced feature is uniquely provided by
This setup can efficiently operate across two or more availability zones,
can rely entirely on object stores for replication, and guarantees a
maximum RPO (Recovery Point
Objective) of 5 minutes. This advanced feature is uniquely provided by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are talking about distributed topologies. It makes sense to talk about regions. Availability zones are already covered by a single cluster with anti-affinity.

The "can rely entirely on object stores for replication" make sense.

Comment thread docs/src/replica_cluster.md Outdated
Comment on lines 3 to 5

@jsilvela jsilvela Jul 23, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO "separate" and "other" used together cause confusion.

Suggested change
A replica cluster is a separate CloudNativePG `Cluster` resource designed to
replicate data from another PostgreSQL instance, ideally also managed by
CloudNativePG.
A replica cluster is a CloudNativePG `Cluster` resource designed to
replicate data from another PostgreSQL instance, ideally also managed by
CloudNativePG.

Comment thread docs/src/replica_cluster.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. **WAL Archive**: Utilize the WAL (Write-Ahead Logging) archive stored in an
2. **WAL Archive**: Use the WAL (Write-Ahead Logging) archive stored in an

Comment thread docs/src/replica_cluster.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
object store. WAL files are regularly transferred from the source to the object
object store. WAL files are regularly transferred from the source cluster to the object

Comment thread docs/src/replica_cluster.md Outdated
Comment on lines 172 to 180

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My brain is twisted at this point.
The south cluster will use the cluster-eu-central as source, but the storage for cluster-eu-central is in the south.
So, we do a crossing here, and then we do another crossing in the replica section below.
But, the storage for the south cluster is likely in the south, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this is switched

Comment thread docs/src/replica_cluster.md Outdated
Comment on lines 239 to 240

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When the primary PostgreSQL cluster is shut down, write operations are no
longer possible. CloudNativePG then:
When the primary PostgreSQL cluster is demoted, write operations are no
longer possible. CloudNativePG then:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mechanically, there is a shutdown, because it needs one to restart as a replica. But we are talking about demotions, so 👍

Comment thread docs/src/replica_cluster.md Outdated
Comment on lines 301 to 303

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yikes. I hope we offer a plugin command to handle making this change safely

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we need to create a kubectl cnpg subcommand for this

@gbartolini
gbartolini requested a review from fcanovai July 24, 2024 09:57
Comment thread docs/src/index.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken link:

Suggested change
environments, thanks to its [distributed topology](distributed_topology.md)
environments, thanks to its [distributed topology](replica_cluster.md#distributed-topology)

Comment thread docs/src/architecture.md Outdated
Comment on lines 113 to 119

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read it fine:

  • if you have two DCs with low latency
  • you can't create a single K8s cluster that covers both, you'd need three DCs (AZs)
  • therefore, you must have two single AZ K8s clusters, an active one and a passive one

And the following hint explain that you may have taken the decision too early, before knowing the implications.

Although I would pluralise the beginning of the sentence. I think that it makes a bit clearer that the k8s clusters must be 2.

Suggested change
A single availability zone Kubernetes cluster is the only viable option when
only **two data centers** are available within reach of a low-latency
connection (typically in the same metropolitan area). Having only two zones
prevents the creation of a multi-availability zone Kubernetes cluster, which
requires a minimum of three zones. As a result, users must create two separate
Kubernetes clusters in an active/passive configuration, with the second cluster
primarily used for Disaster Recovery (see the [replica cluster feature](replica_cluster.md)).
Single availability zone Kubernetes clusters are the only viable option when
only **two data centers** are available within reach of a low-latency
connection (typically in the same metropolitan area). Having only two zones
prevents the creation of a multi-availability zone Kubernetes cluster, which
requires a minimum of three zones. As a result, users must create two separate
Kubernetes clusters in an active/passive configuration, with the second cluster
primarily used for Disaster Recovery (see the [replica cluster feature](replica_cluster.md)).

Comment thread docs/src/installation_upgrade.md Outdated
Comment on lines 272 to 273

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That it will be hell maintaining the clusters. Although nothing will force the sections to be identical, they could be managed by different operators, in different clusters.

We could "strongly suggest".

Comment thread docs/src/installation_upgrade.md Outdated
Comment on lines 281 to 283

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Although the change in the behaviour of enabled should be here, so a bit of context should remain.

Comment thread docs/src/operator_capability_levels.md Outdated
Comment on lines 458 to 463

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should simply remove this and add it back when we rework delayed replica clusters

Comment thread docs/src/operator_capability_levels.md Outdated
Comment on lines 478 to 481

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are talking about distributed topologies. It makes sense to talk about regions. Availability zones are already covered by a single cluster with anti-affinity.

The "can rely entirely on object stores for replication" make sense.

Comment thread docs/src/replica_cluster.md Outdated

@fcanovai fcanovai Jul 24, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very disputed quote according to random people on internet 😄 , but the most similar documented one seems to be by Dwight Eisenhower (November 1957, "planning is everything").

Comment thread docs/src/replica_cluster.md Outdated
Comment on lines 172 to 180

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this is switched

Comment thread docs/src/replica_cluster.md Outdated
Comment on lines 239 to 240

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mechanically, there is a shutdown, because it needs one to restart as a replica. But we are talking about demotions, so 👍

gbartolini and others added 2 commits July 25, 2024 10:33
Document how to enable PostgreSQL distributed database topologies across
Kubernetes clusters for hybrid and multi-cloud scenarios using replica
clusters. With CloudNativePG, you can:

- Declaratively control the primary PostgreSQL cluster.
- Seamlessly demote the current primary and promote another cluster without
  re-cloning.

The goal is to provide enough information to set up an environment across
multiple regions with object stores for replication, guaranteeing a maximum RPO
of 5 minutes, a unique feature of CloudNativePG.

Rename the existing "Replica Cluster" feature to "Standalone Replica Cluster".

Provide information on how to upgrade existing installations to the distributed
topology strategy.

Closes #5087

Signed-off-by: Gabriele Bartolini <[email protected]>
Signed-off-by: Francesco Canovai <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@leonardoce

Copy link
Copy Markdown
Contributor

/ok-to-merge no need for E2e tests, we changed only the documentation

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Jul 25, 2024
@leonardoce
leonardoce merged commit 8a45c22 into main Jul 25, 2024
@leonardoce
leonardoce deleted the dev/5087 branch July 25, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not backport This PR must not be backported - it will be in the next minor release ok to merge 👌 This PR can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs]: Distributed topologies, Demotion of a primary cluster and Promotion of a replica cluster

5 participants