cdist-web/src/extra/manual/7.0.0/cdist-parallelization.html

204 lines
15 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>19. Parallelization &mdash; cdist 7.0.0 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></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="20. Inventory" href="cdist-inventory.html" />
<link rel="prev" title="18. Messaging" href="cdist-messaging.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">
cdist
<img src="_static/cdist-logo.jpeg" class="logo" alt="Logo"/>
</a>
<div class="version">
7.0.0
</div>
<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">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="cdist-why.html">1. Why should I use cdist?</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-features.html">2. Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-os.html">3. Supported operating systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-install.html">4. How to install cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-upgrade.html">5. How to upgrade cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-support.html">6. Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-quickstart.html">7. Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-real-world.html">8. Dive into real world cdist</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist.html">9. cdist(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist-dump.html">10. cdist-dump(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="man1/cdist-new-type.html">11. cdist-new-type(1)</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-bootstrap.html">12. Bootstrap</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-configuration.html">13. Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-manifest.html">14. Manifest</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-type.html">15. cdist type</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-types.html">16. cdist types</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-explorer.html">17. Explorer</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-messaging.html">18. Messaging</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">19. Parallelization</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#description">19.1. Description</a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">19.2. Examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="#caveats">19.3. Caveats</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cdist-inventory.html">20. Inventory</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-preos.html">21. PreOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-scan.html">22. Scan</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-integration.html">23. cdist integration / using cdist as library</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-reference.html">24. Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-best-practice.html">25. Best practice</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-stages.html">26. Execution stages</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-cache.html">27. Local cache overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-saving-output-streams.html">28. Saving output streams</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-remote-exec-copy.html">29. Remote exec and copy commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-hacker.html">30. Hacking</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdist-troubleshooting.html">31. Troubleshooting</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">cdist</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"><span class="section-number">19. </span>Parallelization</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/cdist-parallelization.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="parallelization">
<h1><span class="section-number">19. </span>Parallelization<a class="headerlink" href="#parallelization" title="Permalink to this heading"></a></h1>
<section id="description">
<h2><span class="section-number">19.1. </span>Description<a class="headerlink" href="#description" title="Permalink to this heading"></a></h2>
<p>cdist has two modes of parallel operation.</p>
<p>One of them is to operate on each host in separate process. This is enabled
with <strong>-p/--parallel</strong> option.</p>
<p>The other way is to operate in parallel within one host where you specify
the number of jobs. This is enabled with <strong>-j/--jobs</strong> option where you
can specify the number of parallel jobs. By default,
<strong>multiprocessing.cpu_count()</strong> is used. For this mode global explorers,
object preparation and object run are supported.</p>
<p>You can, of course, use those two options together. This means that each host
will be processed by its own process. Within each process cdist will operate
using specified number of parallel jobs.</p>
<p>For more info on those options see <strong>cdist</strong>(1).</p>
</section>
<section id="examples">
<h2><span class="section-number">19.2. </span>Examples<a class="headerlink" href="#examples" title="Permalink to this heading"></a></h2>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Configure hosts read from file hosts.file in parallel</span>
$<span class="w"> </span>cdist<span class="w"> </span>config<span class="w"> </span>-p<span class="w"> </span>-f<span class="w"> </span>hosts.file
<span class="c1"># Configure hosts read from file hosts.file sequentially but using default</span>
<span class="c1"># number of parallel jobs</span>
$<span class="w"> </span>cdist<span class="w"> </span>config<span class="w"> </span>-j<span class="w"> </span>-f<span class="w"> </span>hosts.file
<span class="c1"># Configure hosts read from file hosts.file in parallel using 16</span>
<span class="c1"># parallel jobs</span>
$<span class="w"> </span>cdist<span class="w"> </span>config<span class="w"> </span>-j<span class="w"> </span><span class="m">16</span><span class="w"> </span>-p<span class="w"> </span>-f<span class="w"> </span>hosts.file
</pre></div>
</div>
</section>
<section id="caveats">
<h2><span class="section-number">19.3. </span>Caveats<a class="headerlink" href="#caveats" title="Permalink to this heading"></a></h2>
<p>When operating in parallel, either by operating in parallel for each host
(-p/--parallel) or by parallel jobs within a host (-j/--jobs), and depending
on target SSH server and its configuration you may encounter connection drops.
This is controlled with sshd :strong:MaxStartups configuration options.
You may also encounter session open refusal. This happens with ssh multiplexing
when you reach maximum number of open sessions permitted per network
connection. In this case ssh will disable multiplexing.
This limit is controlled with sshd :strong:MaxSessions configuration
options. For more details refer to <strong>sshd_config</strong>(5).</p>
<p>For example, if you reach <strong>MaxSessions</strong> sessions you may get the
following output:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>cdist<span class="w"> </span>config<span class="w"> </span>-b<span class="w"> </span>-j<span class="w"> </span><span class="m">11</span><span class="w"> </span>-v<span class="w"> </span><span class="m">78</span>.47.116.244
INFO:<span class="w"> </span>cdist:<span class="w"> </span>version<span class="w"> </span><span class="m">4</span>.2.2-55-g640b7f9
INFO:<span class="w"> </span><span class="m">78</span>.47.116.244:<span class="w"> </span>Running<span class="w"> </span>global<span class="w"> </span>explorers
INFO:<span class="w"> </span><span class="m">78</span>.47.116.244:<span class="w"> </span>Remote<span class="w"> </span>transfer<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="m">11</span><span class="w"> </span>parallel<span class="w"> </span><span class="nb">jobs</span>
channel<span class="w"> </span><span class="m">22</span>:<span class="w"> </span>open<span class="w"> </span>failed:<span class="w"> </span>administratively<span class="w"> </span>prohibited:<span class="w"> </span>open<span class="w"> </span>failed
mux_client_request_session:<span class="w"> </span>session<span class="w"> </span>request<span class="w"> </span>failed:<span class="w"> </span>Session<span class="w"> </span>open<span class="w"> </span>refused<span class="w"> </span>by<span class="w"> </span>peer
ControlSocket<span class="w"> </span>/tmp/tmpuah6fw_t/d886d4b7e4425a102a54bfaff4d2288b/ssh-control-path<span class="w"> </span>already<span class="w"> </span>exists,<span class="w"> </span>disabling<span class="w"> </span>multiplexing
INFO:<span class="w"> </span><span class="m">78</span>.47.116.244:<span class="w"> </span>Running<span class="w"> </span>global<span class="w"> </span>explorers<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="m">11</span><span class="w"> </span>parallel<span class="w"> </span><span class="nb">jobs</span>
channel<span class="w"> </span><span class="m">22</span>:<span class="w"> </span>open<span class="w"> </span>failed:<span class="w"> </span>administratively<span class="w"> </span>prohibited:<span class="w"> </span>open<span class="w"> </span>failed
mux_client_request_session:<span class="w"> </span>session<span class="w"> </span>request<span class="w"> </span>failed:<span class="w"> </span>Session<span class="w"> </span>open<span class="w"> </span>refused<span class="w"> </span>by<span class="w"> </span>peer
ControlSocket<span class="w"> </span>/tmp/tmpuah6fw_t/d886d4b7e4425a102a54bfaff4d2288b/ssh-control-path<span class="w"> </span>already<span class="w"> </span>exists,<span class="w"> </span>disabling<span class="w"> </span>multiplexing
INFO:<span class="w"> </span><span class="m">78</span>.47.116.244:<span class="w"> </span>Running<span class="w"> </span>initial<span class="w"> </span>manifest<span class="w"> </span>/tmp/tmpuah6fw_t/d886d4b7e4425a102a54bfaff4d2288b/data/conf/manifest/init
INFO:<span class="w"> </span><span class="m">78</span>.47.116.244:<span class="w"> </span>Running<span class="w"> </span>manifest<span class="w"> </span>and<span class="w"> </span>explorers<span class="w"> </span><span class="k">for</span><span class="w"> </span>__file/root/host.file
INFO:<span class="w"> </span><span class="m">78</span>.47.116.244:<span class="w"> </span>Generating<span class="w"> </span>code<span class="w"> </span><span class="k">for</span><span class="w"> </span>__file/root/host.file
INFO:<span class="w"> </span><span class="m">78</span>.47.116.244:<span class="w"> </span>Finished<span class="w"> </span>successful<span class="w"> </span>run<span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="m">18</span>.655028820037842<span class="w"> </span>seconds
INFO:<span class="w"> </span>cdist:<span class="w"> </span>Total<span class="w"> </span>processing<span class="w"> </span><span class="nb">time</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="m">1</span><span class="w"> </span>host<span class="o">(</span>s<span class="o">)</span>:<span class="w"> </span><span class="m">19</span>.159148693084717
</pre></div>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="cdist-messaging.html" class="btn btn-neutral float-left" title="18. Messaging" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="cdist-inventory.html" class="btn btn-neutral float-right" title="20. Inventory" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright ungleich GmbH 2021.</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>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>