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

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

ELK5.4修改分片數(shù)及分片分配方式-創(chuàng)新互聯(lián)

一、修改分片數(shù)

南山網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司,南山網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為南山上千多家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的南山做網(wǎng)站的公司定做!

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

這種方式只能針對某個索引單獨修改。如果需要所有索引統(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é)點變動)

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ù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。


網(wǎng)頁標(biāo)題:ELK5.4修改分片數(shù)及分片分配方式-創(chuàng)新互聯(lián)
URL標(biāo)題:http://weahome.cn/article/dseegs.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部