前言
最近es集群進行調(diào)整,從2節(jié)點變成了單節(jié)點。所以需要將集群模式改為單點模式,并需要將es 集群的全部索引副本個數(shù)改為0,不然會有很多未分配的分片,導致集群狀態(tài)為 yellow。
具體實踐
1. 先將現(xiàn)有的index的副本數(shù)量為0個
此步驟是為了解決現(xiàn)有的索引副本數(shù)。文章來源:http://www.zghlxwxcb.cn/news/detail-719795.html
PUT */_settings
{
"index" : {
"number_of_replicas" : 0
}
}
2. 創(chuàng)建模板匹配所有index,并設置副本數(shù)量為0
此步驟是為了解決新增的索引副本數(shù)文章來源地址http://www.zghlxwxcb.cn/news/detail-719795.html
PUT _template/template_log
{
"order": 0,
"template": "*",
"settings": {
"index": {
"number_of_replicas": "0",
"refresh_interval": "30s"
}
},
"mappings": {},
"aliases": {}
}
到了這里,關(guān)于elasticsearch修改es集群的索引副本數(shù)量的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!