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

相关推荐
龙亘川9 小时前
构建城市公共安全数字底座:亘川智城智慧安防系统全维度解读
java·大数据·开发语言·人工智能·信息可视化
BJ_Bonree9 小时前
博睿数据亮相第41届BFSI IT Summit Thailand
大数据·人工智能·物联网
好焊孙辉10 小时前
六成份额之后:鸿栢科技扩大产业规模的几点思考
大数据·人工智能·科技
跨境小彭10 小时前
Temu 全托管模式下,SKU 利润核算的实践复盘
大数据·运维·人工智能·自动化·temu
数智园区合作社10 小时前
问数平台怎么把同一个指标锁成一个数
大数据·数据库·人工智能·ai
2601_9707038312 小时前
工业除湿机租赁:把一份租金合同拆开看
大数据·数据结构·算法·数据库架构·推荐算法
心疼你的一切12 小时前
Python自动发邮件实战定时发报表
大数据·开发语言·python
王中阳Go13 小时前
5.27 分钟干完后端和全部测试:一场三小时笔试的五个失分点,四个不在代码上
大数据·数据库·人工智能·后端·大语言模型
演艺大赏13 小时前
Paimon 1.3.1 报 Proxy user is not supported:Kyuubi + Kerberos 集成排查与源码级定位
大数据