1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢(xún)
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問(wèn)題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
      ElasticSearch中怎么實(shí)現(xiàn)數(shù)據(jù)自動(dòng)冷熱分離

      這篇文章給大家介紹ElasticSearch中怎么實(shí)現(xiàn)數(shù)據(jù)自動(dòng)冷熱分離,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

      10年的崇仁網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開(kāi)發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都營(yíng)銷(xiāo)網(wǎng)站建設(shè)的優(yōu)勢(shì)是能夠根據(jù)用戶(hù)設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整崇仁建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“崇仁網(wǎng)站設(shè)計(jì)”,“崇仁網(wǎng)站推廣”以來(lái),每個(gè)客戶(hù)項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

      1. 節(jié)點(diǎn)tag

      依次啟動(dòng)三個(gè)節(jié)點(diǎn),同時(shí)加入box_type和resource_level標(biāo)簽,box_type標(biāo)記node1、node2為warm節(jié)點(diǎn),node3為hot節(jié)點(diǎn),resource_level標(biāo)記機(jī)器資源的性能,分為高,中,低

      bin/elasticsearch -d -p pid -E node.name=node1 -E node.max_local_storage_nodes=3 -E path.data=node1_data -E path.logs=node1_logs -E node.attr.box_type=warm -E node.attr.resource_level=high
      
      bin/elasticsearch -d -p pid -E node.name=node2 -E node.max_local_storage_nodes=3 -E path.data=node2_data -E path.logs=node2_logs -E node.attr.box_type=warm -E node.attr.resource_level=mdeium
      
      bin/elasticsearch -d -p pid -E node.name=node3 -E node.max_local_storage_nodes=3 -E path.data=node3_data -E path.logs=node3_logs -E node.attr.box_type=hot -E node.attr.resource_level=high
      
      
      查看屬性:kibana中輸入以下命令
      GET _cat/indices?v
      得到以下結(jié)果,可以看到box_type和resource_level標(biāo)簽在每個(gè)節(jié)點(diǎn)的值
      node  host      ip        attr              value
      node3 127.0.0.1 127.0.0.1 ml.machine_memory 17179869184
      node3 127.0.0.1 127.0.0.1 ml.max_open_jobs  20
      node3 127.0.0.1 127.0.0.1 box_type          hot
      node3 127.0.0.1 127.0.0.1 xpack.installed   true
      node3 127.0.0.1 127.0.0.1 resource_level    high
      node1 127.0.0.1 127.0.0.1 ml.machine_memory 17179869184
      node1 127.0.0.1 127.0.0.1 box_type          warm
      node1 127.0.0.1 127.0.0.1 xpack.installed   true
      node1 127.0.0.1 127.0.0.1 ml.max_open_jobs  20
      node1 127.0.0.1 127.0.0.1 resource_level    high
      node2 127.0.0.1 127.0.0.1 ml.machine_memory 17179869184
      node2 127.0.0.1 127.0.0.1 ml.max_open_jobs  20
      node2 127.0.0.1 127.0.0.1 box_type          warm
      node2 127.0.0.1 127.0.0.1 xpack.installed   true
      node2 127.0.0.1 127.0.0.1 resource_level    mdeium

      2. 建立索引

      假設(shè)當(dāng)前時(shí)間為2019年9月1日,作為最新的數(shù)據(jù)存儲(chǔ)在hot節(jié)點(diǎn)上,只需要在建立索引時(shí)指定allocation策略即可

      PUT api_log_2019-09-01
      {
        "settings": {
          "number_of_shards": 3, 
          "number_of_replicas": 0, 
          "index.routing.allocation.require.box_type": "hot">

      假設(shè)建立索引時(shí)沒(méi)有配置該選項(xiàng)也不要緊,動(dòng)態(tài)修改即可

      PUT api_log_2019-09-01/_settings
      {
        "index.routing.allocation.require.box_type": "hot"
      }

      3. 遷移索引

      遷移歷史索引到warm節(jié)點(diǎn)的方式也是采用動(dòng)態(tài)修改請(qǐng)求的方式

      PUT api_log_2019-09-01/_settings
      {
          "index.routing.allocation.require.box_type": "warm",
          "index.routing.allocation.include.resource_level": "mdeium"
      }
      
      我們將api_log_2019-09-01遷移到了box_type為warm,resource_level為mdeium的節(jié)點(diǎn),即node2
      
      通過(guò)查詢(xún)索引分片的分布情況
      GET _cat/shards/api_log_2019-09-01?v
      
      結(jié)果如下:
      index          shard prirep state   docs store ip        node
      api_log_2019-09-01 1     p      STARTED 4711 4.1mb 127.0.0.1 node2
      api_log_2019-09-01 2     p      STARTED 4656   4mb 127.0.0.1 node2
      api_log_2019-09-01 0     p      STARTED 4707 4.1mb 127.0.0.1 node2

      Rollover API

      大家應(yīng)該也注意到了,遷移索引的步驟是手動(dòng)完成的,有沒(méi)有更智能的方式呢,答案是肯定的,rollover API可以很好地實(shí)現(xiàn)這個(gè)功能

      1. rollover

      首先為索引建立別名, 由于多個(gè)index可以對(duì)應(yīng)一個(gè)alias,為了讓es知道往哪個(gè)索引中寫(xiě),標(biāo)記其中一個(gè)索引is_write_index為true,同時(shí)需要注意索引名以橫杠+數(shù)字結(jié)尾的形式命名,這是為了讓es自動(dòng)生成索引

      POST _aliases
      {
        "actions": [
          {
            "remove": {
              "index": "api_log_2019-09-01",
              "alias": "api_logs",
              "is_write_index": true
            }
          }
        ]
      }
      
      rollover API會(huì)根據(jù)設(shè)置的條件(conditions)來(lái)生成新的索引
      
      POST api_logs/_rollover
      {
        "conditions": {
          "max_age": "1d",
          "max_docs": 10000,
          "max_size": "5gb"
        }
      }
      
      conditions的詳細(xì)解釋?zhuān)?
      
      max_age:索引是否創(chuàng)建大于1天
      max_docs:索引文檔數(shù)是否超過(guò)10000
      max_size:索引大小是否超過(guò)5GB
      max_size正在進(jìn)行中的合并會(huì)產(chǎn)生大量的臨時(shí)分片大小增長(zhǎng),而當(dāng)合并結(jié)束后這些增長(zhǎng)會(huì)消失掉,不穩(wěn)定,max_age每個(gè)時(shí)間內(nèi)不一定均衡,max_docs比較合適
      即以上三個(gè)條件滿(mǎn)足其一就會(huì)自動(dòng)rollover

      2. 新索引配置

      rollover也支持索引的settings設(shè)置
      
      POST api_logs/_rollover
      {
        "conditions": {
          "max_age": "1d",
          "max_docs": 10000,
          "max_size": "5gb"
        },
        "settings": {
          "index.number_of_shards": 2
        }
      }

      3. 自定義索引名稱(chēng)

      生成的索引名稱(chēng)為api_log_2019-09-000002, 以長(zhǎng)度為6,序號(hào)+1,左填充0的格式命名,但es支持自定義名稱(chēng),只需要在_rollover端點(diǎn)加入名稱(chēng)即可

      POST api_logs/_rollover/api_log_2019-09-02
      {...}

      關(guān)于ElasticSearch中怎么實(shí)現(xiàn)數(shù)據(jù)自動(dòng)冷熱分離就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。


      標(biāo)題名稱(chēng):ElasticSearch中怎么實(shí)現(xiàn)數(shù)據(jù)自動(dòng)冷熱分離
      本文網(wǎng)址:http://www.ef60e0e.cn/article/gjoccg.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        阿城市| 五原县| 独山县| 竹北市| 景德镇市| 喀喇沁旗| 慈利县| 辽宁省| 运城市| 龙井市| 双柏县| 太和县| 横山县| 招远市| 宣威市| 平塘县| 历史| 镇雄县| 乐东| 韶关市| 泰安市| 鸡泽县| 安西县| 沙田区| 肇东市| 鄂伦春自治旗| 山东| 柘城县| 寿宁县| 阿拉尔市| 安图县| 集贤县| 峨眉山市| 景德镇市| 增城市| 永康市| 台南市| 沙田区| 海城市| 鹤峰县| 武鸣县|