posts - 360,comments - 0,views - 19万

# 查询索引状态,health列结果为green/yellow表示正常

curl -u 账号:密码 -X GET http://<CLUSTER-IP>:9200/_cat/health?v

# 索引状态查询
curl -u 账号:密码 -X GET http://<CLUSTER-IP>:9200/_cat/indices?v

# 占用内存信息查询
curl -u 账号:密码 -X GET <CLUSTER-IP>:9200/_cat/nodes?v\&h=host,heap.current,heap.percent,heap.max,ram.max,disk.avail,node.role,m

# 列出所有索引
curl -u 账号:密码 -X GET http://<CLUSTER-IP>:9200/_cat/indices?v

# 查看某项索引的x个数据
curl -u 账号:密码 -X GET http://<CLUSTER-IP>:9200/<索引项>/_search?size=<数据数>

#新建索引

curl -X PUT "http://localhost:9200/my_new_index"

# 删除索引,高危操作,谨慎执行
curl -u 账号:密码 -XDELETE http://127.0.0.1:9200/<索引名称>

#重建索引

复制代码
POST _reindex
{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter",
"version_type": "internal"
}
复制代码

 

解除只读模式

curl -u "elastic:Do1Portal_2023" -X PUT "localhost:9200/.kibana_7.17.23_001/_settings" -H "Content-Type: application/json" -d'
{
  "index.blocks.read_only_allow_delete": null
}'

 查看分片无法分配下去的原因

GET /_cluster/allocation/explain?pretty

 让Elasticsearch尝试重新分配那些之前分配失败的分片。

POST /_cluster/reroute?retry_failed=true

 问题记录:

报错信息

"a copy of this shard is already allocated to this node [[app-logs-2024.10.13][0], node[dx2fd95lRIOZGabUpOq9ew], [P], s[STARTED], a[id=fsuoPYKwTxeMjpvz_IY_5Q]]

[root@VM-16-30-centos logs]# curl -X PUT -u "es:xxxxx456" "http://127.0.0.1:9200/app-logs-2024.10.13/_settings" -H 'Content-Type: application/json' -d'
{
  "index": {
    "number_of_replicas": 0
  }
}

 

posted on   属于我的梦,明明还在  阅读(25)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示