elasticsearch副本和分片

1.文档冲突

当我们使用index API更新文档,可以一次性读取

修改索引副本

bash 复制代码
root@es-node3:~# curl -XPUT http://192.168.1.136:9200/es-syslog-2023.08.26/_settings -H "Content-Type: application/json" -d '{
>   "settings": {
>     "index": {
>       "number_of_shards": 3,
>       "number_of_replicas": 2
>     }
>   }
> }'
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Can't update non dynamic settings [[index.number_of_shards]] for open indices [[es-syslog-2023.08.26/5EEqjFuGTBe6_wdyoBeV7g]]"}],"type":"illegal_argument_exception","reason":"Can't update non dynamic settings [[index.number_of_shards]] for open indices [[es-syslog-2023.08.26/5EEqjFuGTBe6_wdyoBeV7g]]"},"status":400}r

看起来您正在尝试修改一个已经打开的索引的非动态设置index.number_of_shards。在默认情况下,Elasticsearch不允许在索引处于打开状态时修改非动态(不可更改)的设置。

curl -XPOST http://192.168.1.136:9200/es-syslog-2023.08.26/_close

使用以下命令来修改索引的设置:

curl -XPUT http://192.168.1.136:9200/es-syslog-2023.08.26/_settings -H "Content-Type: application/json" -d '{

"settings": {

"index.number_of_shards": 3

}

}'

重新打开索引。

curl -XPOST http://192.168.1.136:9200/es-syslog-2023.08.26/_open

迁移分片

curl -XPOST -H "Content-Type: application/json" -d '{

"commands": [

{

"move": {

"index": "es-syslog-2023.12.03",

"shard": 0,

"from_node": "es-node2",

"to_node": "es-node1"

}

}

]

}' http://localhost:9200/_cluster/reroute

相关推荐
极客数模7 小时前
【2026美赛赛题初步翻译F题】2026_ICM_Problem_F
大数据·c语言·python·数学建模·matlab
编程彩机9 小时前
互联网大厂Java面试:从分布式架构到大数据场景解析
java·大数据·微服务·spark·kafka·分布式事务·分布式架构
vx-bot55566610 小时前
企业微信接口在多租户SaaS平台中的集成架构与数据隔离实践
大数据·架构·企业微信
bubuly12 小时前
软件开发全流程注意事项:从需求到运维的全方位指南
大数据·运维·数据库
xixixi7777714 小时前
基于零信任架构的通信
大数据·人工智能·架构·零信任·通信·个人隐私
Hello.Reader14 小时前
Flink 自适应批执行(Adaptive Batch Execution)让 Batch 作业“边跑边优化”
大数据·flink·batch
LaughingZhu16 小时前
Product Hunt 每日热榜 | 2026-01-31
大数据·人工智能·经验分享·搜索引擎·产品运营
babe小鑫16 小时前
中专学历进入快消大厂终端销售岗位的可行性分析
大数据
samFuB16 小时前
【工具变量】区县5A级旅游景区DID数据集(2000-2025年)
大数据
百夜﹍悠ゼ16 小时前
数据治理DataHub安装部署
大数据·数据治理