Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CN-1152]: add localConfig to persistence #171

Merged
merged 20 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
name: hazelcast <1>
spec:
clusterSize: 3
repository: 'docker.io/hazelcast/hazelcast-enterprise'
licenseKeySecretName: hazelcast-license-key
persistence:
pvc:
accessModes: ["ReadWriteOnce"]
requestStorage: 20Gi
restore:
localConfig:
baseDir: "base" <2>
backupDir: "backup" <3>
backupFolder: "backup-1709045128548" <4>
38 changes: 28 additions & 10 deletions docs/modules/ROOT/pages/backup-restore.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

This topic assumes that you know about Persistence in Hazelcast. To learn about Persistence, see the xref:hazelcast:storage:persistence.adoc[Platform documentation].

There are two options for a backup: local and external. Local backups are kept in volume and never moved anywhere whereas external backups are moved into buckets provided by the user.
There are two options for a backup: local and external. Local backups are kept in volume and never moved anywhere whereas external backups are moved into buckets provided by the user.
kutluhanmetin marked this conversation as resolved.
Show resolved Hide resolved

TIP: For a working example, see link:https://docs.hazelcast.com/tutorials/hazelcast-platform-operator-external-backup-restore[this tutorial].

Expand All @@ -23,8 +23,8 @@ include::ROOT:example$/hazelcast-persistence.yaml[]
<1> <<recovery-policy, Cluster recovery policy>>.
<2> Size of the PersistentVolumeClaim (PVC) where Hazelcast data is persisted.
<3> Agent responsible for moving data from the local storage to external buckets.
The agent configuration is optional. If you enable `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.
The agent configuration is optional. If you enable `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.

NOTE: Make sure to calculate the total disk space that you will use. The total used disk space may be larger than the size of in-memory data, depending on how many <<local-backup, backups>> you take.

Expand Down Expand Up @@ -155,7 +155,7 @@ hot-backup Success

To restore a cluster from local backups, you can directly reapply the `Hazelcast` resource, which gives the cluster access to the PVCs that contain the persisted data. This will restore the Hazelcast cluster from existing `hot-restart` folders.

Or, to restore from local backups that you have taken using the `HotBackup` resource, give the `HotBackup` resource name in the restore configuration. For the restore to work correctly, make sure the status of the `HotBackup` resource is `Success`.
Or, to restore from local backups that you have taken using the `HotBackup` resource, give the `HotBackup` resource name in the restore configuration. For the restore to work correctly, make sure the status of the `HotBackup` resource is `Success`.

When this restore mechanism is used, the Restore Agent container is
deployed with the Hazelcast container in the same Pod. The agent starts as an initContainer before the Hazelcast container.
Expand All @@ -168,8 +168,24 @@ include::ROOT:example$/hazelcast-persistence-restore-cr-name.yaml[]

<1> `HotBackup` resource name used for restore. The backup folder name will be taken from the `HotBackup` resource.
<2> Agent responsible for restoring data from the local storage.
The agent configuration is optional. If you give `restore` under `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.
The agent configuration is optional. If you give `restore` under `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.

NOTE: For restore to be successful you have to give restore configuration at the `Hazelcast` custom resource creation. Otherwise, triggering restore on currently running members will likely to fail.
kutluhanmetin marked this conversation as resolved.
Show resolved Hide resolved

To restore from local backups that is not taken by HotBackup resource, configure `localConfig`.
kutluhanmetin marked this conversation as resolved.
Show resolved Hide resolved

[source,yaml,subs="attributes+"]
----
include::ROOT:example$/hazelcast-persistence-restore-local.yaml[]
----

<1> For restore to be successful, name of the cluster that the backup taken and restored must be the same.
kutluhanmetin marked this conversation as resolved.
Show resolved Hide resolved
<2> `baseDir` is the root directory of persistence.
<3> `backupDir` is the directory for backups.
<4> `backupFolder` is the folder for a specific backup.
kutluhanmetin marked this conversation as resolved.
Show resolved Hide resolved

NOTE: Agent copies backup to be restored from `baseDir` + `backupDir` + `backupFolder` to `/data/hot-restart` path.
kutluhanmetin marked this conversation as resolved.
Show resolved Hide resolved

== Restoring from External Backups

Expand All @@ -192,8 +208,8 @@ include::ROOT:example$/hazelcast-persistence-restore-external.yaml[]
<1> Bucket URI where backup data will be restored from.
<2> Name of the secret with credentials for accessing the given bucket URI.
<3> Agent which is responsible for restoring data from the external storage.
The agent configuration is optional. If you provide `restore` under `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.
The agent configuration is optional. If you provide `restore` under `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.
--

HotBackup resource name::
Expand All @@ -206,12 +222,14 @@ include::ROOT:example$/hazelcast-persistence-restore-cr-name.yaml[]

<1> `HotBackup` resource name used for the restore. The bucket URI and secret are taken from the `HotBackup` resource.
<2> Agent responsible for restoring data from external storage.
The agent configuration is optional. If you provide `restore` under `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.
The agent configuration is optional. If you provide `restore` under `persistence` and do not pass the agent configuration, Hazelcast Platform Operator
uses the latest agent version that is compatible with its version.
--

====

NOTE: For restore to be successful you have to give restore configuration at the `Hazelcast` custom resource creation. Otherwise, triggering restore on currently running members will likely to fail.
kutluhanmetin marked this conversation as resolved.
Show resolved Hide resolved

== Configuring Persistence

=== Data Recovery Timeout
Expand Down