Skip to content

Commit e26ad81

Browse files
gbartolinimnencia
andauthored
docs: add backup, WAL archive and recovery information (#291)
Reorganised the content, with a different structure, added license information and instructions for spellchecking. Closes #290 Signed-off-by: Gabriele Bartolini <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]>
1 parent 4be694b commit e26ad81

File tree

15 files changed

+499
-96
lines changed

15 files changed

+499
-96
lines changed

.wordlist.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Azurite
33
BarmanObjectStore
44
BarmanObjectStoreConfiguration
55
BarmanObjectStores
6+
CRD
67
CloudNativePG
8+
DataBackupConfiguration
79
DigitalOcean
810
Docusaurus
911
EKS
@@ -24,17 +26,24 @@ ObjectStore
2426
ObjectStoreSpec
2527
ObjectStoreStatus
2628
PITR
29+
PoR
30+
PostgreSQL
31+
Postgres
2732
README
33+
RPO
34+
RTO
2835
RecoveryWindow
2936
RetentionPolicy
3037
SAS
3138
SFO
3239
SPDX
40+
SPDX
3341
ServerRecoveryWindow
3442
TLS
3543
TODO
3644
Uncomment
3745
WAL
46+
WALBackupConfiguration
3847
WALs
3948
api
4049
apiVersion
@@ -46,6 +55,7 @@ backend
4655
backends
4756
barmanObjectName
4857
barmancloud
58+
bzip
4959
cd
5060
cloudnative
5161
clusterrole
@@ -64,6 +74,7 @@ externalClusters
6474
gcs
6575
gf
6676
github
77+
gzip
6778
hostpath
6879
http
6980
https
@@ -89,6 +100,7 @@ rc
89100
recoverability
90101
repos
91102
retentionCheckInterval
103+
retentionPolicy
92104
rolebinding
93105
sc
94106
secretKeyRef

web/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
This website is built using [Docusaurus](https://docusaurus.io/), a modern
44
static website generator.
55

6+
### Requirements
7+
8+
- Docker
9+
- [Yarn](https://yarnpkg.com/)
10+
- [Dagger](https://dagger.io/)
11+
- [Task](https://taskfile.dev/)
12+
613
### Installation
714

815
```shell
@@ -35,6 +42,14 @@ $ yarn serve
3542

3643
By default, this will load your site at http://localhost:3000/.
3744

45+
### Spellchecking
46+
47+
From the top directory:
48+
49+
```shell
50+
task spellcheck
51+
```
52+
3853
### Versioning
3954

4055
Docusaurus allows versioning of the documentation to maintain separate sets of

web/docs/compression.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
sidebar_position: 80
3+
---
4+
5+
# Compression
6+
7+
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
8+
9+
By default, backups and WAL files are archived **uncompressed**. However, the
10+
Barman Cloud Plugin supports multiple compression algorithms via
11+
`barman-cloud-backup` and `barman-cloud-wal-archive`, allowing you to optimize
12+
for space, speed, or a balance of both.
13+
14+
### Supported Compression Algorithms
15+
16+
- `bzip2`
17+
- `gzip`
18+
- `lz4` (WAL only)
19+
- `snappy`
20+
- `xz` (WAL only)
21+
- `zstd` (WAL only)
22+
23+
Compression settings for base backups and WAL archives are configured
24+
independently. For implementation details, refer to the corresponding API
25+
definitions:
26+
27+
- [`DataBackupConfiguration`](https://pkg.go.dev/github.com/cloudnative-pg/barman-cloud/pkg/api#DataBackupConfiguration)
28+
- [`WALBackupConfiguration`](https://pkg.go.dev/github.com/cloudnative-pg/barman-cloud/pkg/api#WalBackupConfiguration)
29+
30+
:::important
31+
Compression impacts both performance and storage efficiency. Choose the right
32+
algorithm based on your recovery time objectives (RTO), storage capacity, and
33+
network throughput.
34+
:::
35+
36+
## Compression Benchmark (on MinIO)
37+
38+
| Compression | Backup Time (ms) | Restore Time (ms) | Uncompressed Size (MB) | Compressed Size (MB) | Ratio |
39+
| ----------- | ---------------- | ----------------- | ---------------------- | -------------------- | ----- |
40+
| None | 10,927 | 7,553 | 395 | 395 | 1.0:1 |
41+
| bzip2 | 25,404 | 13,886 | 395 | 67 | 5.9:1 |
42+
| gzip | 116,281 | 3,077 | 395 | 91 | 4.3:1 |
43+
| snappy | 8,134 | 8,341 | 395 | 166 | 2.4:1 |

web/docs/concepts.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
sidebar_position: 10
3+
---
4+
5+
# Main Concepts
6+
7+
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
8+
9+
:::important
10+
Before proceeding, make sure to review the following sections of the
11+
CloudNativePG documentation:
12+
13+
- [**Backup**](https://cloudnative-pg.io/documentation/current/backup/)
14+
- [**WAL Archiving**](https://cloudnative-pg.io/documentation/current/wal_archiving/)
15+
- [**Recovery**](https://cloudnative-pg.io/documentation/current/recovery/)
16+
:::
17+
18+
The **Barman Cloud Plugin** enables **hot (online) backups** of PostgreSQL
19+
clusters in CloudNativePG through [`barman-cloud`](https://pgbarman.org),
20+
supporting continuous physical backups and WAL archiving to an **object
21+
store**—without interrupting write operations.
22+
23+
It also supports both **full recovery** and **Point-in-Time Recovery (PITR)**
24+
of a PostgreSQL cluster.
25+
26+
## The Object Store
27+
28+
At the core is the [`ObjectStore` custom resource (CRD)](plugin-barman-cloud.v1.md#objectstorespec),
29+
which acts as the interface between the PostgreSQL cluster and the target
30+
object storage system. It allows you to configure:
31+
32+
- **Authentication and bucket location** via the `.spec.configuration` section
33+
- **WAL archiving** settings—such as compression type, parallelism, and
34+
server-side encryption—under `.spec.configuration.wal`
35+
- **Base backup options**—with similar settings for compression, concurrency,
36+
and encryption—under `.spec.configuration.data`
37+
- **Retention policies** to manage the life-cycle of archived WALs and backups
38+
via `.spec.configuration.retentionPolicy`
39+
40+
WAL files are archived in the `wals` directory, while base backups are stored
41+
as **tarballs** in the `base` directory, following the
42+
[Barman Cloud convention](https://docs.pgbarman.org/cloud/latest/usage/#object-store-layout).
43+
44+
:::tip
45+
For details, refer to the
46+
[API reference for the `ObjectStore` resource](plugin-barman-cloud.v1.md#objectstorespec).
47+
:::
48+
49+
## Integration with a CloudNativePG Cluster
50+
51+
CloudNativePG can delegate continuous backup and recovery responsibilities to
52+
the **Barman Cloud Plugin** by configuring the `.spec.plugins` section of a
53+
`Cluster` resource. This setup requires a corresponding `ObjectStore` resource
54+
to be defined.
55+
56+
:::important
57+
While it is technically possible to reuse the same `ObjectStore` for multiple
58+
`Cluster` resources within the same namespace, it is strongly recommended to
59+
dedicate one object store per PostgreSQL cluster to ensure data isolation and
60+
operational clarity.
61+
:::
62+
63+
The following example demonstrates how to configure a CloudNativePG cluster
64+
named `cluster-example` to use a previously defined `ObjectStore` (also named
65+
`cluster-example`) in the same namespace. Setting `isWALArchiver: true` enables
66+
WAL archiving through the plugin:
67+
68+
```yaml
69+
apiVersion: postgresql.cnpg.io/v1
70+
kind: Cluster
71+
metadata:
72+
name: cluster-example
73+
spec:
74+
# Other cluster settings...
75+
plugins:
76+
- name: barman-cloud.cloudnative-pg.io
77+
isWALArchiver: true
78+
parameters:
79+
barmanObjectName: cluster-example
80+
```
81+
82+
## Backup of a Postgres Cluster
83+
84+
Once the object store is defined and the `Cluster` is configured to use the
85+
Barman Cloud Plugin, **WAL archiving is activated immediately** on the
86+
PostgreSQL primary.
87+
88+
Physical base backups are seamlessly managed by CloudNativePG using the
89+
`Backup` and `ScheduledBackup` resources, respectively for
90+
[on-demand](https://cloudnative-pg.io/documentation/current/backup/#on-demand-backups)
91+
and
92+
[scheduled](https://cloudnative-pg.io/documentation/current/backup/#scheduled-backups)
93+
backups.
94+
95+
To use the Barman Cloud Plugin, you must set the `method` to `plugin` and
96+
configure the `pluginConfiguration` section as shown:
97+
98+
```yaml
99+
[...]
100+
spec:
101+
method: plugin
102+
pluginConfiguration:
103+
name: barman-cloud.cloudnative-pg.io
104+
[...]
105+
```
106+
107+
With this configuration, CloudNativePG supports:
108+
109+
- Backups from both **primary** and **standby** instances
110+
- Backups from **designated primaries** in a distributed topology using
111+
[replica clusters](https://cloudnative-pg.io/documentation/current/replica_cluster/)
112+
113+
:::tip
114+
For details on how to back up from a standby, refer to the official documentation:
115+
[Backup from a standby](https://cloudnative-pg.io/documentation/current/backup/#backup-from-a-standby).
116+
:::
117+
118+
:::important
119+
Both backup and WAL archiving operations are executed by sidecar containers
120+
running in the same pod as the PostgreSQL `Cluster` primary instance—except
121+
when backups are taken from a standby, in which case the sidecar runs alongside
122+
the standby pod.
123+
The sidecar containers use a [dedicated container image](images.md) that
124+
includes only the supported version of Barman Cloud.
125+
:::
126+
127+
## Recovery of a Postgres Cluster
128+
129+
In PostgreSQL, *recovery* refers to the process of starting a database instance
130+
from an existing backup. The Barman Cloud Plugin integrates with CloudNativePG
131+
to support both **full recovery** and **Point-in-Time Recovery (PITR)** from an
132+
object store.
133+
134+
Recovery in this context is *not in-place*: it bootstraps a brand-new
135+
PostgreSQL cluster from a backup and replays the necessary WAL files to reach
136+
the desired recovery target.
137+
138+
To perform a recovery, define an *external cluster* that references the
139+
appropriate `ObjectStore`, and use it as the source in the `bootstrap` section
140+
of the target cluster:
141+
142+
```yaml
143+
[...]
144+
spec:
145+
[...]
146+
bootstrap:
147+
recovery:
148+
source: source
149+
externalClusters:
150+
- name: source
151+
plugin:
152+
name: barman-cloud.cloudnative-pg.io
153+
parameters:
154+
barmanObjectName: cluster-example
155+
serverName: cluster-example
156+
[...]
157+
```
158+
159+
The critical element here is the `externalClusters` section of the `Cluster`
160+
resource, where the `plugin` stanza instructs CloudNativePG to use the Barman
161+
Cloud Plugin to access the object store for recovery.
162+
163+
This same mechanism can be used for a variety of scenarios enabled by the
164+
CloudNativePG API, including:
165+
166+
* **Full cluster recovery** from the latest backup
167+
* **Point-in-Time Recovery (PITR)**
168+
* Bootstrapping **replica clusters** in a distributed topology
169+
170+
:::tip
171+
For complete instructions and advanced use cases, refer to the official
172+
[Recovery documentation](https://cloudnative-pg.io/documentation/current/recovery/).
173+
:::

web/docs/features.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

web/docs/images.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
sidebar_position: 40
3+
---
4+
5+
# Container Images
6+
7+
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
8+
9+
TODO

0 commit comments

Comments
 (0)