mysql https://blog.werk21.de/de de Set Limit for open files for MySQL on Ubuntu 16.04 with systemd https://blog.werk21.de/en/2017/04/19/set-limit-open-files-mysql-ubuntu-1604-systemd <span>Limit für open files für MySQL auf Ubuntu 16.04 mit systemd neu setzen</span> <span><span lang="" about="/de/user/15" typeof="schema:Person" property="schema:name" datatype="">kelly</span></span> <span><time datetime="2017-04-19T17:59:37+02:00" title="Mittwoch, 19. April 2017 - 17:59 Uhr">Mi., 19.04.2017 - 17:59 Uhr</time> </span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Um die Fehlermeldung</p> <blockquote>Out of resources when opening file './database/table.MYD' (Errcode: 24 - Too many open files)</blockquote> <p>auf Ubuntu 16.04 zu beheben, müssen die Limits erhöht und Änderungen an der systemd-Konfiguration vorgenommen werden.</p> <h2>1. Limits erhöhen</h2> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;">vi <span style="color: #339933;">/</span>etc<span style="color: #339933;">/</span>security<span style="color: #339933;">/</span>limits<span style="color: #339933;">.</span>d<span style="color: #339933;">/</span><span style="color: #cc66cc;">99</span><span style="color: #339933;">-</span>openfiles<span style="color: #339933;">.</span>conf</pre></div> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#&lt;domain&gt; &lt;type&gt; &lt;item&gt; &lt;value&gt; </span><a href="http://www.php.net/mysql"><span style="color: #990000;">mysql</span></a> soft nofile <span style="color: #cc66cc;">8192</span> <a href="http://www.php.net/mysql"><span style="color: #990000;">mysql</span></a> hard nofile <span style="color: #cc66cc;">8192</span></pre></div> <p>Wenn die Limits für alle user und root neu gesetzt werden sollen, können auch diese Einstellungen verwendet werden:</p> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#&lt;domain&gt; &lt;type&gt; &lt;item&gt; &lt;value&gt; </span><span style="color: #339933;">*</span> soft nofile <span style="color: #cc66cc;">8192</span> <span style="color: #339933;">*</span> hard nofile <span style="color: #cc66cc;">8192</span> root soft nofile <span style="color: #cc66cc;">8192</span> root hard nofile <span style="color: #cc66cc;">8192</span></pre></div> <h2>2. Anpassen der systemd-Konfiguration</h2> <p>Auf Ubuntu 16.04 werden die Dienste mit systemd gestartet. Daher müssen auch hier noch Anpassungen vorgenommen werden:</p> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;">systemctl edit <a href="http://www.php.net/mysql"><span style="color: #990000;">mysql</span></a></pre></div> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>Service<span style="color: #009900;">&#93;</span> LimitNOFILE<span style="color: #339933;">=</span><span style="color: #cc66cc;">8192</span></pre></div> <p>(Editor verlassen mit <em>:x</em>)</p> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;">systemctl daemon<span style="color: #339933;">-</span>reload service <a href="http://www.php.net/mysql"><span style="color: #990000;">mysql</span></a> restart</pre></div> <h2>3. Kontrollieren der MySQL-Einstellungen</h2> <p>Standardmäßig ist die MySQL-Variable open_files_limit auf 5000 gesetzt. Wenn der Wert erhöht werden muss:</p> <p>vi /etc/mysql/mysql.conf.d/xx-openfiles.cnf</p> <div class="geshifilter"><pre class="php geshifilter-php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>mysqld<span style="color: #009900;">&#93;</span> open_files_limit <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20000</span></pre></div> <p>Alternativ kann natürlich auch diese Variable in der /etc/mysql/my.cnf im Abschnitt [mysqld] ergänzt werden.</p></div> <div class="field field--name-field-systems field--type-entity-reference field--label-inline"> <div class="field--label">Systeme</div> <a href="/de/systems/server" class="label label-default" hreflang="de">Server</a> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline"> <div class="field--label">Tags</div> <a href="/de/tags/mysql" class="label label-default" hreflang="de">mysql</a> <a href="/de/tags/ubuntu" class="label label-default" hreflang="de">ubuntu</a> <a href="/de/tags/server" class="label label-default" hreflang="de">server</a> <a href="/en/tags/open-files" class="label label-default" hreflang="en">open files</a> </div> Wed, 19 Apr 2017 15:42:40 +0000 kelly 118 at https://blog.werk21.de