From d977796f18e4fbb3099e915e09a010c2743977b4 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Wed, 21 Nov 2018 16:59:46 +0100 Subject: [PATCH] Add SnapJob docs --- docs/configuration/jobs.rst | 41 +++++++++++++++++++++++++++++++++--- docs/configuration/prune.rst | 33 ++++++++++++++++++++++++++--- 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/docs/configuration/jobs.rst b/docs/configuration/jobs.rst index a7bdcae..ae25e2f 100644 --- a/docs/configuration/jobs.rst +++ b/docs/configuration/jobs.rst @@ -17,7 +17,7 @@ Overview & Terminology A *job* is the unit of activity tracked by the zrepl daemon and configured in the |mainconfig|. Every job has a unique ``name``, a ``type`` and type-dependent fields which are documented on this page. -Replication always happens between a pair of jobs: one is the **active side**, and one the **passive side**. +Aside from ``snap`` jobs, which are special jobs only for snapshotting and pruning, replication always happens between a pair of jobs: one is the **active side**, and one the **passive side**. The active side executes the replication logic whereas the passive side responds to requests after checking the active side's permissions. For communication, the active side connects to the passive side using a :ref:`transport ` and starts issuing remote procedure calls (RPCs). @@ -35,6 +35,12 @@ The following table shows how different job types can be combined to achieve bot | Local replication | | ``push`` + ``sink`` in one config | * Backup FreeBSD boot pool | | | | with :ref:`local transport ` | | +-----------------------+--------------+----------------------------------+-----------------------------------------------+ +| SnapJob | ``snap`` | N/A | * Data requires versioning but no backups | +| | | | * Combined with a ``push`` or ``pull`` job: | +| | | | | +| | | | * High frequency local snapshotting | +| | | | * Low frequency replication | ++-----------------------+--------------+----------------------------------+-----------------------------------------------+ How the Active Side Works ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -114,7 +120,7 @@ Regardless of whether that keep rule is used, the bookmark ensures that replicat Taking Snaphots --------------- -The ``push`` and ``source`` jobs can automatically take periodic snapshots of the filesystems matched by the ``filesystems`` filter field. +The ``push``, ``source`` and ``snap`` jobs can automatically take periodic snapshots of the filesystems matched by the ``filesystems`` filter field. The snapshot names are composed of a user-defined prefix followed by a UTC date formatted like ``20060102_150405_000``. We use UTC because it will avoid name conflicts when switching time zones or between summer and winter time. @@ -136,7 +142,7 @@ For ``push`` jobs, replication is automatically triggered after all filesystems There is also a ``manual`` snapshotting type, which covers the following use cases: -* Existing infrastructure for automatic snapshots: you only want to use zrepl for replication. +* Separate ``snap`` job or external infrastructures for automatic snapshots: you want to use this zrepl job for replication. * Run scripts before and after taking snapshots (like locking database tables). We are working on better integration for this use case: see :issue:`74`. @@ -255,6 +261,35 @@ Job Type ``source`` Example config: :sampleconf:`/source.yml` +.. _job-snap: + +Job Type ``snap`` +----------------- + +Job type that only takes care of local snapshotting and pruning. + +.. list-table:: + :widths: 20 80 + :header-rows: 1 + + * - Parameter + - Comment + * - ``type`` + - = ``snap`` + * - ``name`` + - unique name of the job + * - ``filesystems`` + - |filter-spec| for filesystems to be snapshotted + * - ``snapshotting`` + - |snapshotting-spec| + * - ``pruning`` + - |pruning-spec| + +Example config: :sampleconf:`/snap.yml` + + + + .. _replication-local: Local replication diff --git a/docs/configuration/prune.rst b/docs/configuration/prune.rst index ef40ce3..63b8042 100644 --- a/docs/configuration/prune.rst +++ b/docs/configuration/prune.rst @@ -10,10 +10,12 @@ Typically, the requirements to temporal resolution and maximum retention time di For example, when using zrepl to back up a busy database server, you will want high temporal resolution (snapshots every 10 min) for the last 24h in case of administrative disasters, but cannot afford to store them for much longer because you might have high turnover volume in the database. On the receiving side, you may have more disk space available, or need to comply with other backup retention policies. -zrepl uses a set of **keep rules** to determine which snapshots shall be kept per filesystem. +zrepl uses a set of **keep rules** per replication side to determine which snapshots shall be kept per filesystem. **A snapshot that is not kept by any rule is destroyed.** The keep rules are **evaluated on the active side** (:ref:`push ` or :ref:`pull job `) of the replication setup, for both active and passive side, after replication completed or was determined to have failed permanently. + + Example Configuration: :: @@ -53,14 +55,39 @@ Example Configuration: It is currently not possible to define pruning on a source job. The source job creates snapshots, which means that extended replication downtime will fill up the source's zpool with snapshots, since pruning is directed by the corresponding active side (pull job). - If this is a potential risk for you, consider using :ref:`push mode `. + If this is a potential risk for you, consider using :ref:`push mode ` or adding a pruning-only :ref:`snap job ` to thin out extremely old snapshots in case the pull job doesn't prune for a very long time. + + +.. _prune-local-vs-twosided: + +Local vs two-sided ``pruning`` Syntax +------------------------------------- + +Since ``snap`` jobs work locally only, their ``pruning`` field takes a simple ``keep`` instead of ``keep_sender`` and ``keep_receiver``. + +:: + + jobs: + - type: snap + pruning: + keep: + - type: not_replicated + ... + + - type: push + pruning: + keep_sender: + - type: not_replicated + ... + keep_receiver: + ... + .. _prune-keep-not-replicated: Policy ``not_replicated`` ------------------------- - :: jobs: