<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 禁用swapping 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html) 譯文鏈接 : [http://www.apache.wiki/pages/viewpage.action?pageId=9406682](http://www.apache.wiki/pages/viewpage.action?pageId=9406682) 貢獻者 : [阿叩](/display/~luanqing),[ApacheCN](/display/~apachecn),[Apache中文網](/display/~apachechina) ## 禁用swapping 大多數操作系統嘗試使用盡可能多的內存文件系統緩存和熱切換出未使用的應用程序內存。這可能導致部分JVM堆被交換到磁盤上。 對于性能和節點的穩定性交換是非常糟糕的,應該不惜一切代價避免。它可能導致垃圾收集持續幾分鐘而不是毫秒,這可能導致節點響應緩慢,甚至脫離集群。 有三種方式禁用swapping: ## [開啟bootstrap.memory_lock](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Disable_swapping.md#開啟bootstrapmemory_lock) 第一步,在Linux與Unix系統中使用[mlockall](http://opengroup.org/onlinepubs/007908799/xsh/mlockall.html)或者在Windows系統中使用[VirtuallLock](https://msdn.microsoft.com/en-us/library/windows/desktop/aa366895%28v=vs.85%29.aspx)來嘗試在RAM中鎖定進程的地址空間,來阻止Elasticsearch內存被交換出去。 如果這些設置完成,請在`config/elasticsearch.yml`中添加如下行: ```source-yaml bootstrap.memory_lock: true ``` > 警告 > > 如果試圖分配的內存大于可用內存,`mlockall`可能導致JVM或shell會話退出! Elasticsearch啟動之后,你可以通過下面請求輸出結果中的`mlockall`對應的值來驗證是否設置成功: ```source-js GET _nodes?filter_path=**.mlockall ``` 如果你看到`mlockall`為`false`,那么意味著`mlockall`請求失敗了。你也可以在日志文件中通過`Unable to lock JVM Memory`關鍵詞獲取更多的信息。 最可能的原因,在Linux與Unix系統上,運行Elasticsearch的用戶沒有權限鎖定內存。這可以通過如下獲得: ### [`.zip`與`.tar.gz`安裝包](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Disable_swapping.md#zip與targz安裝包) ??啟動Elasticsearch之前通過root設置[ulimit -l ulimited](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Configuring_system_settings.md#ulimit),或者在[/etc/security/limits.conf](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Configuring_system_settings.md#limits.conf)中設置?memlock?為?unlimited?。 ### [RPM與Debian安裝包](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Disable_swapping.md#rpm與debian安裝包) ??在[系統配置](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Configuring_system_settings.md#sysconfig)中設置?MAX_LOCKED_MEMORY?為?ulimited?(或者參見如下?systemd?的設置方式)。 ### [系統使用`systemd`](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Disable_swapping.md#系統使用systemd) ??在[systemd配置](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Configuring_system_settings.md#systemd)中設置?LimitMEMLOCK?為?infinity。 `mlockall`失敗的另一個可能的原因是臨時目錄(通常是`/tmp`)掛載使用`noexec`選項。這可以通過設置`ES_JAVA_OPTS`的環境變量來指定一個新的臨時目錄: ```source-shell export ES_JAVA_OPTS="$ES_JAVA_OPTS -Djava.io.tmpdir=/path/to/temp/dir" ./bin/elasticsearch ``` 或者在`jvm.options`配置文件中設置。 ## [禁用所有的swap文件](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Disable_swapping.md#禁用所有的swap文件) 第二種方式就是徹底禁用swap。通常Elasticsearch是運行在一個獨立的機器上,且內存使用是通過JVM來控制的。這可能不需要開啟swap。 在Linux操作系統,你可以通過`sudo swapoff -a`來臨時禁用swap。要永久的停用swap,可以通過編輯`/etc/fstab`文件,注釋文件中所有包含swap單詞的行。 在Windows操作系統,你可以通過`系統設置-&gt;高級-&gt;性能-&gt;高級-&gt;虛擬內存`來禁用分頁文件。 ## [配置`swappiness`](https://github.com/aqlu/elasticsearch-reference-cn/blob/master/Setup_Elasticsearch/Important_System_Configuration/Disable_swapping.md#配置swappiness) 另一種方式在Linux系統上可用,確保設置`vm.swappiness`為1。這減少了內核交換的傾向和正常情況下不應該導致,同時仍然允許在緊急條件下整個系統交換。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看