真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

ELK5.4修改分片數(shù)及分片分配方式

一、修改分片數(shù)

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站制作、網(wǎng)站建設(shè)、宜川網(wǎng)絡(luò)推廣、小程序開發(fā)、宜川網(wǎng)絡(luò)營銷、宜川企業(yè)策劃、宜川品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供宜川建站搭建服務(wù),24小時服務(wù)熱線:13518219792,官方網(wǎng)址:www.cdcxhl.com

elasticsearch默認(rèn)分片數(shù)為5,副本數(shù)為1.如果需要修改分片數(shù)有兩種方式

1、修改索引settings

查看索引狀態(tài):curl -GET "http://localhost:9200/index/__settings"

修改索引狀態(tài)信息:

curl -XPUT 'localhost:9200/index/_settings' -d '{
    "index" : {       
            "number_of_replicas" : 6,
        "number_of_replicas": 2
    }}'

這種方式只能針對某個索引單獨(dú)修改。如果需要所有索引統(tǒng)一修改,就需要修改模板信息

2、修改模板

#獲取默認(rèn)模板信息
curl -XGET http://localhost:9200/_template/logstash

#刪除默認(rèn)模板
curl -XDELETE http://localhost:9200/_template/logstash

#上傳修改后的默認(rèn)模板

curl -XPUT http://localhost:9200/_template/logstash -d '
{
        "template": "logstash-*",
        "settings": {
            "index": {
                "number_of_replicas": "2",
                "number_of_shards": "6",
                "refresh_interval": "5s"
            }
        },
        "mappings": {
            "_default_": {
                "dynamic_templates": [
                    {
                        "message_field": {
                            "path_match": "message",
                            "mapping": {
                                "norms": false,
                                "type": "text"
                            },
                            "match_mapping_type": "string"
                        }
                    },
                    {
                        "string_fields": {
                            "mapping": {
                                "norms": false,
                                "type": "text",
                                "fields": {
                                    "keyword": {
                                        "type": "keyword"
                                    }
                                }
                            },
                            "match_mapping_type": "string",
                            "match": "*"
                        }
                    }
                ],
                "_all": {
                    "norms": false,
                    "enabled": true
                },
                "properties": {
                    "@timestamp": {
                        "include_in_all": false,
                        "type": "date"
                    },
                    "geoip": {
                        "dynamic": true,
                        "properties": {
                            "ip": {
                                "type": "ip"
                            },
                            "latitude": {
                                "type": "half_float"
                            },
                            "location": {
                                "type": "geo_point"
                            },
                            "longitude": {
                                "type": "half_float"
                            }
                        }
                    },
                    "@version": {
                        "include_in_all": false,
                        "type": "keyword"
                    }
                }
            }
        },
        "aliases": {}
    }
'

二、分片分配

默認(rèn)情況下shard分片是大致均衡的,但是primary 主分片分配不均衡(某個ES重啟或者集群節(jié)點(diǎn)變動) 

Shard Allocation Settingsedit

The following dynamic settings may be used to control shard allocation and recovery:

  • cluster.routing.allocation.enable

  • Enable or disable allocation for specific kinds of shards:

    • all -             (default) Allows shard allocation for all kinds of shards.

    • primaries -       Allows shard allocation only for primary shards.

    • new_primaries -   Allows shard allocation only for primary shards for new indices.

    • none -            No shard allocations of any kind are allowed for any indices.

上面這個參數(shù)可以設(shè)定分片分配的方式。

PUT _cluster/settings{
  "transient": {
    "cluster.routing.allocation.enable": primaries
  
  }}

網(wǎng)頁名稱:ELK5.4修改分片數(shù)及分片分配方式
文章鏈接:http://weahome.cn/article/iehssd.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部