mirror of
https://github.com/zrepl/zrepl.git
synced 2025-04-26 04:19:40 +02:00
docs: update 'mappping & filter syntax' + more elaborate sampleconf
This commit is contained in:
parent
ea6f02368b
commit
e6d08149ef
@ -7,7 +7,8 @@ jobs:
|
|||||||
mapping: {
|
mapping: {
|
||||||
"zroot/var/db<": "storage/backups/local/zroot/var/db",
|
"zroot/var/db<": "storage/backups/local/zroot/var/db",
|
||||||
"zroot/usr/home<": "storage/backups/local/zroot/usr/home",
|
"zroot/usr/home<": "storage/backups/local/zroot/usr/home",
|
||||||
"zroot/var/tmp": "!", #don't backup /tmp
|
"zroot/usr/home/paranoid": "!", #don't backup paranoid user
|
||||||
|
"zroot/poudriere/ports<": "!", #don't backup the ports trees
|
||||||
}
|
}
|
||||||
snapshot_prefix: zrepl_
|
snapshot_prefix: zrepl_
|
||||||
interval: 10m
|
interval: 10m
|
||||||
|
@ -4,19 +4,15 @@ weight = 20
|
|||||||
description = "How to specify mappings & filters"
|
description = "How to specify mappings & filters"
|
||||||
+++
|
+++
|
||||||
|
|
||||||
{{% alert theme="warning" %}}Under Construction{{% /alert %}}
|
|
||||||
|
|
||||||
## Mapping & Filter Syntax
|
## Mapping & Filter Syntax
|
||||||
|
|
||||||
For various job types, a filesystem `mapping` or `filter` needs to be
|
For various job types, a filesystem `mapping` or `filter` needs to be
|
||||||
specified.
|
specified.
|
||||||
|
|
||||||
Both have in common that they return a result for a given filesystem path (in
|
Both have in common that they take a filesystem path (in the ZFS filesystem hierarchy)as parameters and return something.
|
||||||
the ZFS filesystem hierarchy): mappings return a *target filesystem*, filters
|
Mappings return a *target filesystem* and filters return a *filter result*.
|
||||||
return a *filter result* (`omit`, `ok`).
|
|
||||||
|
|
||||||
The pattern syntax is the same for mappings and filters and is documented in
|
The pattern syntax is the same for mappings and filters and is documented in the following section.
|
||||||
the following section.
|
|
||||||
|
|
||||||
#### Pattern Syntax
|
#### Pattern Syntax
|
||||||
|
|
||||||
@ -49,44 +45,59 @@ tank/var/log => 1
|
|||||||
|
|
||||||
#### Mappings
|
#### Mappings
|
||||||
|
|
||||||
The example below shows a pull job that would pull remote datasets to the given local paths.<br />
|
Mappings map a *filesystem path* to a *target filesystem*.
|
||||||
If there exists no mapping (`NO MATCH`), the filesystem will not be pulled.
|
Per pattern, either a target filesystem path or `"!"` is specified as a result.
|
||||||
|
|
||||||
|
* If no pattern matches, there exists no target filesystem (`NO MATCH`).
|
||||||
|
* If the result is a `"!"`, there exists no target filesystem (`NO MATCH`).
|
||||||
|
* If the pattern is a non-wildcard pattern, the filesystem specified on the left is mapped to the target filesystem on the right.
|
||||||
|
* If the pattern is a *subtree wildcard* pattern, the root of the subtree specified in the pattern is mapped to the target filesystem on the right and all children are mapped bewlow it.
|
||||||
|
|
||||||
|
Note that paths are never appended - a mapping represents a correspondence between a path on the left and a path on the right.
|
||||||
|
|
||||||
|
The example is from the {{< sampleconflink "localbackup/host1.yml" >}} example config.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
pull:
|
jobs:
|
||||||
app01.example.com: # client identity
|
- name: mirror_local
|
||||||
from: app01.example.com
|
type: local
|
||||||
mapping: {
|
mapping: {
|
||||||
"tank/var/db<": "zroot/backups/app01/tank/var/db",
|
"zroot/var/db<": "storage/backups/local/zroot/var/db",
|
||||||
"tank/var/www<": "zroot/backups/app01/tank/var/www",
|
"zroot/usr/home<": "storage/backups/local/zroot/usr/home",
|
||||||
"tank/var/log": "zroot/logbackup/app01",
|
"zroot/usr/home/paranoid": "!", #don't backup paranoid user
|
||||||
|
"zroot/poudriere/ports<": "!", #don't backup the ports trees
|
||||||
}
|
}
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
tank/var/db` => zroot/backups/app01/tank/var/db
|
zroot/var/db => storage/backups/local/zroot/var/db
|
||||||
tank/var/db/a/child => zroot/backups/app01/tank/var/db/a/child
|
zroot/var/db/a/child => storage/backups/local/zroot/var/db/a/child
|
||||||
...
|
zroot/usr/home => storage/backups/local/zroot/usr/home
|
||||||
tank/var/www => zroot/backups/app01/tank/var/www
|
zroot/usr/home/paranoid => NOT MAPPED
|
||||||
tank/var/www/a/child => zroot/backups/app01/tank/var/www/a/child
|
zroot/usr/home/bob => storage/backups/local/zroot/usr/home/bob
|
||||||
...
|
zroot/usr/src => NOT MAPPED
|
||||||
tank/var/log => zroot/logbackup/app01
|
zroot/poudriere/ports/2017Q3 => NOT MAPPED
|
||||||
tank/var/log/foo => NOT MAPPED
|
zroot/poudriere/ports/HEAD => NOT MAPPED
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Filters
|
#### Filters
|
||||||
|
|
||||||
Valid filter results: `ok` or `omit`.
|
Valid filter results: `ok` or `!`.
|
||||||
|
|
||||||
The example below shows a pull ACL that allows access to the user homes but not
|
The example below show the source job from the [tutorial]({{< relref "tutorial/_index.md#configure-app-srv" >}}):
|
||||||
to the rest of the system's datasets.
|
|
||||||
|
|
||||||
```
|
The client is allowed access to `zroot/var/db`, `zroot/usr/home` + children except `zroot/usr/home/paranoid`.
|
||||||
# Example for filter syntax
|
|
||||||
pull_acls:
|
```yaml
|
||||||
backups.example.com: # client identity
|
jobs:
|
||||||
filter: {
|
- name: pull_backup
|
||||||
"<": omit,
|
type: source
|
||||||
"tank/usr/home<": ok,
|
...
|
||||||
|
datasets: {
|
||||||
|
"zroot/var/db": "ok",
|
||||||
|
"zroot/usr/home<": "ok",
|
||||||
|
"zroot/usr/home/paranoid": "!",
|
||||||
}
|
}
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user