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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 一、介紹 `Elastic Stack 6.6`版本后推出了新功能`Index Lifecycle Management(索引生命周期管理)`,支持針對索引的全生命周期托管管理,并且在`Kibana`上也提供了一套 UI 界面來配置策略。 ## 二、生命周期 ### 2.1. 階段介紹 索引生命周期分為4個階段:hot、warm、cold、delete,其中hot主要負責對索引進行rollover操作。 > rollover:滾動更新創建的新索引將添加到索引別名,并被指定為寫索引。 > 4個階段中只有hot階段是必須的 ![](https://img.kancloud.cn/8a/9c/8a9c9f53fe389056fdbc8e00b9d5f427_1636x600.png) 索引根據時間參數min\_age進入生命周期階段,若未設置,默認是0ms。min\_age通常是從創建索引的時間開始計算,如果索引被設置為滾動索引,那么min\_age是從索引滾動開始計算。注意,在檢查min\_age參數并進入下一個階段前,當前階段的操作必須完成。 ### 2.2. 階段動作 | 階段/action | 優先級設置 | 取消跟隨 | 滾動索引 | 分片分配 | 只讀 | 強制段合并 | 收縮索引 | 凍結索引 | 刪除 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | hot | √ | √ | √ | × | × | × | × | × | × | | warm | √ | √ | × | √ | √ | √ | √ | × | × | | cold | √ | √ | × | √ | × | × | × | √ | × | | delete | × | × | × | × | × | × | × | × | √ | ### 2.3. 例子 下面以索引`syslog-2020.10.01`為例子,在索引創建 1 天后轉為 Warm 階段,30 天后轉為 Cold 階段,30 天后刪除 | 日期 | 動作 | 階段 | | --- | --- | --- | | 2020-10-01 | 創建索引`syslog-2020.10.01`,處理讀寫請求 | hot階段 | | 2020-10-02 | `syslog-2020.10.01`改為只讀 | warm階段 | | 2020-11-01 | `syslog-2020.10.01`為只讀,并遷移到冷節點儲存 | cold階段 | | 2020-12-01 | 刪除索引`syslog-2020.10.01` | delete階段 | ## 三、模擬過程 ### 3.1. 創建索引生命周期策略 假設`Policy`設定如下: * 索引以每10個文檔做一次`Rollover` * `Rollover`后 5 秒轉為`Warm`階段 * `Rollover`后 20 秒轉為`Cold`階段 * `Rollover`后 40 秒刪除 ~~~ curl -XPUT "http://$IP:9200/_ilm/policy/my_ilm_policy" \ -H 'Content-Type: application/json' \ -u elastic:changeme \ -d '{ "policy": { "phases": { "hot": { "actions": { "rollover": { "max_docs": "10" } } }, "warm": { "min_age": "5s", "actions": { "allocate": { "include": { "box_type": "warm" } } } }, "cold": { "min_age": "20s", "actions": { "allocate": { "include": { "box_type": "cold" } } } }, "delete": { "min_age": "40s", "actions": { "delete": {} } } } } }' ~~~ > ip、用戶名和密碼按實際情況修改 ### 3.2. 關聯策略 關聯策略有兩種方式,分別是使用索引模板關聯和索引直接關聯 #### 3.2.1. 索引模板關聯 索引模板來創建所需的索引,并關聯ilm策略 ~~~ curl -XPUT "http://$IP:9200/_template/my_test_template" \ -H 'Content-Type: application/json' \ -u elastic:changeme \ -d '{ "index_patterns": ["my-test-*"], "settings": { "number_of_shards": 1, "number_of_replicas": 0, "index.lifecycle.name": "my_ilm_policy", "index.lifecycle.rollover_alias": "my-test", "index.routing.allocation.include.box_type": "hot" } }' ~~~ > ip、用戶名和密碼按實際情況修改 > [index.lifecycle.name](http://index.lifecycle.name/):指明該索引應用的 ILM Policy > index.lifecycle.rollover\_alias:指明在 Rollover 的時候使用的 alias > index.routing.allocation.include.box\_type:指明新建的索引都分配在 hot 節點上 #### 3.2.2. 索引直接關聯 為現有的索引單獨關聯策略 ~~~ curl -XPUT "http://$IP:9200/my-test-*/_settings" \ -H 'Content-Type: application/json' \ -u elastic:changeme \ -d '{ "index": { "lifecycle": { "name": "my_ilm_policy" } } }' ~~~ > ip、用戶名和密碼按實際情況修改 ### 3.3. 查看索引所處階段 ~~~ http://$IP:9200/my-test-*/_ilm/explain ~~~ ### 3.4. 更新策略 1. 如果沒有index應用這份策略,那么我們可以直接更新該策略。 2. 如果有index應用了這份策略,那么當前正在執行的階段不會同步修改,當當前階段結束后,會進入新版本策略的下個階段。 3. 如果更換了策略,當前正在執行的階段不會變化,在結束當前階段后,將會由新的策略管理下一個生命周期。 ### 3.5. kibana圖形化操作 上述的步驟,大部分都可以在`Kibana`中以圖形化界面的方式進行操作 ![](https://img.kancloud.cn/72/06/7206aaf542448c60af806d414bc00491_1524x594.png) ![](https://img.kancloud.cn/9b/72/9b72f42d047742f28fce68c129e17e84_1329x882.png) > 注意:如果使用圖形化界面來創建策略,刪除階段會缺失`actions`內容而導致無法刪除 ## 四、修改輪詢間隔(可選) ILM Service 會在后臺輪詢執行 Policy,默認間隔時間為 10 分鐘,為了測試更快地看到效果,可將其修改為1秒。 ~~~ curl -XPUT "http://$IP:9200/_cluster/settings" \ -H 'Content-Type: application/json' \ -u elastic:changeme \ -d '{ "persistent": { "indices.lifecycle.poll_interval":"1s" } }' ~~~ > ip、用戶名和密碼按實際情況修改 ## 五、啟動和停止索引生命周期管理 > ILM 默認開啟 由ILM管理的所有索引將繼續執行其策略。有時可能不需要某些索引,甚至集群中的所有索引都不需要。例如,當需要集群拓撲更改時,可能會有計劃的維護窗口,這可能會影響正在運行的ILM操作。因此,ILM有兩種禁用操作的方法。 停止ILM時,快照生命周期管理操作也會停止,這意味著不會創建計劃的快照(當前正在進行的快照不受影響)。 通常,ILM將默認運行。要查看ILM的當前運行狀態,請使用[Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-get-status.html)來查看ILM的當前狀態。 ~~~ GET _ilm/status ~~~ 如果請求沒有遇到錯誤,您將收到以下結果: ~~~ { "operation_mode": "RUNNING" } ~~~ **ILM的操作模式**: | 階段/action | 優先級設置 | | --- | --- | | 正在運行 | 正常運行,所有策略均正常執行 | | 停止 | ILM已收到停止請求,但仍在處理某些策略 | | 已停止 | 這表示沒有執行任何策略的狀態 | ### 5.1. 停止ILM 可以暫停ILM服務,以便使用[Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-stop.html)不再執行其他步驟。 ~~~ POST _ilm/stop ~~~ 停止后,所有其他政策措施都將停止。這將反映在狀態API中 ~~~ { "operation_mode": "STOPPING" } ~~~ 然后,ILM服務將異步地將所有策略運行到可以安全停止的位置。在ILM確認它是安全的之后,它將移至該`STOPPED`模式 ~~~ { "operation_mode": "STOPPED" } ~~~ ### 5.2. 啟動ILM 要啟動ILM并繼續執行策略,請使用[Start API](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-start.html)。 ~~~ POST _ilm/start ~~~ Start API將向ILM服務發送請求,以立即開始正常操作。 ~~~ { "operation_mode": "RUNNING" } ~~~ ## 六、API清單 您可以使用以下API來管理索引策略。有關更多信息,請參閱[管理索引生命周期](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/index-lifecycle-management.html)。 * 政策管理API * [創建生命周期策略](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-put-lifecycle.html) * [獲取生命周期策略](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-get-lifecycle.html) * [刪除生命周期策略](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-delete-lifecycle.html) * 索引管理API * [將索引移至步驟](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-move-to-step.html) * [重試索引策略](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-retry-policy.html) * [從索引中刪除策略](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-remove-policy.html) * 運營管理API * [獲取ILM操作模式](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-get-status.html) * [啟動ILM](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-start.html) * [停止ILM](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-stop.html) * [解釋API](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/ilm-explain-lifecycle.html)
                  <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>

                              哎呀哎呀视频在线观看