<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Shrink Index /縮小索引 注意:涉及翻譯內容: Index-索引;types-類型;mapping-映射;aliases-別名;shards-分片;replicas-副本 縮小索引API可以允許你將存在的索引轉變為一個只包含主要分片的新索引。目標索引中請求的主要分片數量必須要為原索引中的因子(即原分片數量是新分片倍數),例如8個分片可以縮小到4、2、1個分片。如果原分片數量為素數則只能縮小到一個分片。在縮小開始時,每個分片的復制都必須在同一節點(node)存在。 縮小工作如下: * 首先,以相同配置創建目標索引,但是主分片數量減少。 * 然后硬鏈接( hard-linking ) 各部分自原索引到目標索引。(如果系統不支持硬鏈接,那么索引的所有部分都將復制遷移到新索引,將會花費大量時間) * 最終,將會恢復目標索引,因為目標索引剛被重新打開就會被關閉。 * Finally, it recovers the target index as though it were a closed index which had just been re-opened. # Preparing an index for shrinking /準備縮小索引 為了縮小索引,索引必須被標記為只讀,所有分片都會復制到一個相同的節點并且節點健康為綠色。 這兩個條件可以通過下列請求實現: | `curl -XPUT?``'localhost:9200/my_source_index/_settings?pretty'`?`-d'` `{` `"settings"``: {` `"index.routing.allocation.require._name"``:?``"shrink_node_name"``,` `"index.blocks.write"``:?``true` `}` `}'` | | [![](https://www.elastic.co/guide/en/elasticsearch/reference/current/images/icons/callouts/1.png)](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html#CO120-1) | 強制所有分片都復制遷移到名字為?`shrink_node_name 的節點上,通過`?[Shard Allocation Filtering](https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html "Shard Allocation Filtering")?獲取更多設置信息。 | | [![](https://www.elastic.co/guide/en/elasticsearch/reference/current/images/icons/callouts/2.png)](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html#CO120-2) | 避免索引的所有寫操作,但是依然可以修改索引的基本信息,例如刪除索引。 | 從原索引遷移將會花費一定時間。進度信息可以在所有分片都遷移完成前通過?[`_cat recovery`API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html "cat recovery")? 或者??[`cluster health`?API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html "Cluster Health")?使用?`wait_for_no_relocating_shards`?參數獲得。 # Shrinking an index /縮小索引 縮小索引?`my_source_index`?到 新的索引?my_target_index ,可以用下列請求: | `curl -XPOST?``'localhost:9200/my_source_index/_shrink/my_target_index?pretty'` | 上述請求將會在目標索引信息加入到集群時立即返回——他不會等到縮小操作開始。 ? ![Important](https://www.elastic.co/guide/en/elasticsearch/reference/current/images/icons/important.png)縮小索引需要滿足下列要求: * 目標索引存在 * 原索引主分片數量比目標索引多 * 原索引主分片數量是目標索引倍數 * 索引中的所有文檔在目標索引將會被縮小到一個分片的數量不會超過?`2,147,483,519`?,因為這是一個分片的承受的最大文檔數量。 * 執行縮小進程的節點必須要有足夠的空閑磁盤空間滿足原索引的分片能夠全部復制遷徙到該節點。 縮小索引API和創建索引?[`(create index)`?API](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html "Create Index")?相似,并且對于目標索引接受?`settings`?和?`aliases 參數` | `curl -XPOST?``'localhost:9200/my_source_index/_shrink/my_target_index?pretty'`?`-d'` `{` `"settings"``: {` `"index.number_of_replicas"``:?``1``,` `"index.number_of_shards"``:?``1``,` `"index.codec"``:?``"best_compression"` `},` `"aliases"``: {` `"my_search_indices"``: {}` `}` `}'` | | [![](https://www.elastic.co/guide/en/elasticsearch/reference/current/images/icons/callouts/1.png)](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html#CO121-1) | 注意目標分片數量為原分片數量的因子 | | [![](https://www.elastic.co/guide/en/elasticsearch/reference/current/images/icons/callouts/2.png)](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html#CO121-2) | ?best_compression 最佳壓縮時只會影響新寫到索引的數據,例如當 force-merging 分片。 | ? 映射(Mappings) 不應該在縮小API中制定,因為所有的?`index.analysis.*?`和?`index.similarity.*`?設置都會被原索引配置覆蓋。 # Monitoring the shrink process /監測縮小進程 The shrink process can be monitored with the?[`_cat recovery`?API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html "cat recovery"), or the?[`cluster health`?API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html "Cluster Health")?can be used to wait until all primary shards have been allocated by setting the?`wait_for_status`parameter to?`yellow`. 縮小進度可以被?[`_cat recovery`?API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html "cat recovery")?或者?[`cluster health`?API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html "Cluster Health")?所監控。通過設置?wait_for_status 為 yellow ,可以等到所有的主分片都已經分配。 縮小API會在目標索引被創建時馬上返回,這發生在所有分片被分配之前。這點說明這時所有分片都處于?`unassigned 狀態,如果出于任何原因目標索引分片無法分配到執行縮小的節點上,那么主分片狀態會一直停留在?`unassigned ,直到分片被分配。`` 一旦主節點分配成功,會轉化狀態會?initializing ,縮小進程就開始執行。當縮小操作結束的時候,這些分片會被激活。在這之后,Elasticsearch將試圖分配副本,甚至可能決定主分片遷至另一個節點。 # Wait For Active Shards /等待激活分片 因為縮小操作會創建新的索引,所以?[wait for active shards](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html#create-index-wait-for-active-shards "Wait For Active Shardsedit")?設置依然有效。
                  <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>

                              哎呀哎呀视频在线观看