-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage.html
288 lines (266 loc) · 19.9 KB
/
usage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Usage — zrepl documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/banner.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Migrating Sending Side" href="usage/runbooks/migrating_sending_side_to_new_zpool.html" />
<link rel="prev" title="Miscellaneous" href="configuration/misc.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
zrepl
<img src="_static/zrepl.svg" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quick Start by Use Case</a></li>
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Usage</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#cli-overview">CLI Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="#zrepl-daemon">zrepl daemon</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#restarting">Restarting</a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemd-unit-file">Systemd Unit File</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#ops-runbooks">Ops Runbooks</a><ul>
<li class="toctree-l3"><a class="reference internal" href="usage/runbooks/migrating_sending_side_to_new_zpool.html">Migrating Sending Side</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#platform-tests">Platform Tests</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pr.html">Talks & Presentations</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/zrepl/zrepl">GitHub Repository & Issue Tracker</a></li>
<li class="toctree-l1"><a class="reference external" href="https://matrix.to/#/#zrepl:matrix.org">Chat: Matrix</a></li>
<li class="toctree-l1"><a class="reference internal" href="supporters.html">Supporters</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">zrepl</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Usage</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/zrepl/zrepl/blob/master/docs/usage.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="usage">
<span id="id1"></span><h1>Usage<a class="headerlink" href="#usage" title="Link to this heading"></a></h1>
<section id="cli-overview">
<h2>CLI Overview<a class="headerlink" href="#cli-overview" title="Link to this heading"></a></h2>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The zrepl binary is self-documenting:
run <code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">help</span></code> for an overview of the available subcommands or <code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">SUBCOMMAND</span> <span class="pre">--help</span></code> for information on available flags, etc.</p>
</div>
<table class="docutils align-default" id="cli-signal-wakeup">
<colgroup>
<col style="width: 30%" />
<col style="width: 70%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Subcommand</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">help</span></code></p></td>
<td><p>show subcommand overview</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">daemon</span></code></p></td>
<td><p>run the daemon, required for all zrepl functionality</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">status</span></code></p></td>
<td><p>show job activity, or with <code class="docutils literal notranslate"><span class="pre">--mode</span> <span class="pre">raw</span></code> for JSON output</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">stdinserver</span></code></p></td>
<td><p>see <a class="reference internal" href="configuration/transports.html#transport-ssh-stdinserver"><span class="std std-ref">ssh+stdinserver Transport</span></a></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">signal</span> <span class="pre">wakeup</span> <span class="pre">JOB</span></code></p></td>
<td><p>manually trigger replication + pruning of JOB</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">signal</span> <span class="pre">reset</span> <span class="pre">JOB</span></code></p></td>
<td><p>manually abort current replication + pruning of JOB</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">configcheck</span></code></p></td>
<td><p>check if config can be parsed without errors</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">migrate</span></code></p></td>
<td><div class="line-block">
<div class="line">perform on-disk state / ZFS property migrations</div>
<div class="line">(see <a class="reference internal" href="changelog.html#changelog"><span class="std std-ref">changelog</span></a> for details)</div>
</div>
</td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">zfs-abstraction</span></code></p></td>
<td><p>list and remove zrepl’s abstractions on top of ZFS, e.g. holds and step bookmarks (see <a class="reference internal" href="configuration/overview.html#replication-cursor-and-last-received-hold"><span class="std std-ref">overview</span></a> )</p></td>
</tr>
</tbody>
</table>
</section>
<section id="zrepl-daemon">
<span id="usage-zrepl-daemon"></span><h2>zrepl daemon<a class="headerlink" href="#zrepl-daemon" title="Link to this heading"></a></h2>
<p>All actual work zrepl does is performed by a daemon process.
The daemon supports structured <a class="reference internal" href="configuration/logging.html#logging"><span class="std std-ref">logging</span></a> and provides <a class="reference internal" href="configuration/monitoring.html#monitoring"><span class="std std-ref">monitoring endpoints</span></a>.</p>
<p>When installing from a package, the package maintainer should have provided an init script / systemd.service file.
You should thus be able to start zrepl daemon using your init system.</p>
<p>Alternatively, or for running zrepl in the foreground, simply execute <code class="docutils literal notranslate"><span class="pre">zrepl</span> <span class="pre">daemon</span></code>.
Note that you won’t see much output with the <a class="reference internal" href="configuration/logging.html#logging-default-config"><span class="std std-ref">default logging configuration</span></a>:</p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Make sure to actually monitor the error level output of zrepl: some configuration errors will not make the daemon exit.</p>
<p>Example: if the daemon cannot create the <a class="reference internal" href="configuration/transports.html#transport-ssh-stdinserver"><span class="std std-ref">ssh+stdinserver Transport</span></a> sockets in the runtime directory,
it will emit an error message but not exit because other tasks such as periodic snapshots & pruning are of equal importance.</p>
</div>
<section id="restarting">
<span id="usage-zrepl-daemon-restarting"></span><h3>Restarting<a class="headerlink" href="#restarting" title="Link to this heading"></a></h3>
<p>The daemon handles SIGINT and SIGTERM for graceful shutdown.
Graceful shutdown means at worst that a job will not be rescheduled for the next interval.
The daemon exits as soon as all jobs have reported shut down.</p>
</section>
<section id="systemd-unit-file">
<h3>Systemd Unit File<a class="headerlink" href="#systemd-unit-file" title="Link to this heading"></a></h3>
<p>A systemd service definition template is available in <a class="reference external" href="https://github.com/zrepl/zrepl/blob/master/dist/systemd">dist/systemd</a>.
Note that some of the options only work on recent versions of systemd.
Any help & improvements are very welcome, see <a class="reference external" href="https://github.com/zrepl/zrepl/issues/145">issue #145</a>.</p>
</section>
</section>
<section id="ops-runbooks">
<h2>Ops Runbooks<a class="headerlink" href="#ops-runbooks" title="Link to this heading"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="usage/runbooks/migrating_sending_side_to_new_zpool.html">Migrating Sending Side</a></li>
</ul>
</div>
</section>
<section id="platform-tests">
<span id="usage-platform-tests"></span><h2>Platform Tests<a class="headerlink" href="#platform-tests" title="Link to this heading"></a></h2>
<p>Along with the main <code class="docutils literal notranslate"><span class="pre">zrepl</span></code> binary, we release the <code class="docutils literal notranslate"><span class="pre">platformtest</span></code> binaries.
The zrepl platform tests are an integration test suite that is complementary to the pure Go unit tests.
Any test that needs to interact with ZFS is a platform test.</p>
<p>The platform need to run as root.
For each test, we create a fresh dummy zpool backed by a file-based vdev.
The file path, and a root mountpoint for the dummy zpool, must be specified on the command line:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mkdir</span> <span class="o">-</span><span class="n">p</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">zreplplatformtest</span>
<span class="o">./</span><span class="n">platformtest</span> \
<span class="o">-</span><span class="n">poolname</span> <span class="s1">'zreplplatformtest'</span> \ <span class="c1"># <- name must contain zreplplatformtest</span>
<span class="o">-</span><span class="n">imagepath</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">zreplplatformtest</span><span class="o">.</span><span class="n">img</span> \ <span class="c1"># <- zrepl will create the file</span>
<span class="o">-</span><span class="n">mountpoint</span> <span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">zreplplatformtest</span> <span class="c1"># <- must exist</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p><code class="docutils literal notranslate"><span class="pre">platformtest</span></code> will unconditionally overwrite the file at <cite>imagepath</cite>
and unconditionally <code class="docutils literal notranslate"><span class="pre">zpool</span> <span class="pre">destroy</span> <span class="pre">$poolname</span></code>.
So, don’t use a production poolname, and consider running the test in a VM.
It’ll be a lot faster as well because the underlying operations, <code class="docutils literal notranslate"><span class="pre">zfs</span> <span class="pre">list</span></code> in particular, will be faster.</p>
</div>
<p>While the platformtests are running, there will be a log of log output.
After all tests have run, it prints a summary with a list of tests, grouped by result type (success, failure, skipped):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">PASSING</span> <span class="n">TESTS</span><span class="p">:</span>
<span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">platformtest</span><span class="o">/</span><span class="n">tests</span><span class="o">.</span><span class="n">BatchDestroy</span>
<span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">platformtest</span><span class="o">/</span><span class="n">tests</span><span class="o">.</span><span class="n">CreateReplicationCursor</span>
<span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">platformtest</span><span class="o">/</span><span class="n">tests</span><span class="o">.</span><span class="n">GetNonexistent</span>
<span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">platformtest</span><span class="o">/</span><span class="n">tests</span><span class="o">.</span><span class="n">HoldsWork</span>
<span class="o">...</span>
<span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">platformtest</span><span class="o">/</span><span class="n">tests</span><span class="o">.</span><span class="n">SendStreamNonEOFReadErrorHandling</span>
<span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">platformtest</span><span class="o">/</span><span class="n">tests</span><span class="o">.</span><span class="n">UndestroyableSnapshotParsing</span>
<span class="n">SKIPPED</span> <span class="n">TESTS</span><span class="p">:</span>
<span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">zrepl</span><span class="o">/</span><span class="n">platformtest</span><span class="o">/</span><span class="n">tests</span><span class="o">.</span><span class="n">SendArgsValidationEncryptedSendOfUnencryptedDatasetForbidden__EncryptionSupported_false</span>
<span class="n">FAILED</span> <span class="n">TESTS</span><span class="p">:</span> <span class="p">[]</span>
</pre></div>
</div>
<p>If there is a failure, or a skipped test that you believe should be passing, re-run the test suite, capture stderr & stdout to a text file, and create an issue on GitHub.</p>
<p>To run a specific test case, or a subset of tests matched by regex, use the <code class="docutils literal notranslate"><span class="pre">-run</span> <span class="pre">REGEX</span></code> command line flag.</p>
<p>To stop test execution at the first failing test, and prevent cleanup of the dummy zpool, use the <code class="docutils literal notranslate"><span class="pre">-failure.stop-and-keep-pool</span></code> flag.</p>
<p>To build the platformtests yourself, use <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test-platform-bin</span></code>.
There’s also the <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test-platform</span></code> target to run the platform tests with a default command line.</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="configuration/misc.html" class="btn btn-neutral float-left" title="Miscellaneous" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="usage/runbooks/migrating_sending_side_to_new_zpool.html" class="btn btn-neutral float-right" title="Migrating Sending Side" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2017-2023, Christian Schwarz.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Other Versions</span>
v: stable
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
<dt>Tags</dt>
<dd><a href="v0.6.1/usage.html">v0.6.1</a></dd>
<dd><a href="v0.5.0/usage.html">v0.5.0</a></dd>
<dd><a href="v0.4.0/usage.html">v0.4.0</a></dd>
<dd><a href="v0.3.1/usage.html">v0.3.1</a></dd>
<dd><a href="v0.2.1/usage.html">v0.2.1</a></dd>
<dd><a href="v0.1.1/usage.html">v0.1.1</a></dd>
</dl>
<dl>
<dt>Branches</dt>
<dd><a href="usage.html">stable</a></dd>
<dd><a href="master/usage.html">master</a></dd>
</dl>
</div>
</div><script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>