三人行必有我师

Elasticsearch6.x 以上版本,如何设置副本数量?

Elasticsearch | 作者 AiToMaKoTo | 发布于2018年03月15日 | 阅读数:9059

我在配置文件中设置副本数,然后启动ES报错,用curl 设置,然后它将命令作为数据导入到了ES中,求大佬说一下,新版本ES如何设置副本?
已邀请:

luohuanfeng

赞同来自:

可以在索引模板中设置副本数量 .
"number_of_replicas"  这参数了解一下.

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自:

方案一:创建索引的时候设置PUT twitter
{
    "settings" : {
        "index" : {
            "number_of_shards" : 3, 
            "number_of_replicas" : 2 
        }
    }
}

GET twitter
 
方案二:
或者在创建Maping的时候设置:
PUT test
{
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "type1" : {
            "properties" : {
                "field1" : { "type" : "text" }
            }
        }
    }
}
 

要回复问题请先登录注册