ElasticStack - 常用命令

本文介绍了Elasticsearch的基本管理和维护操作,包括查看集群健康状态、集群设置、在线节点及主节点信息,以及如何查看和管理索引和分片等。还提供了动态调整副本数、复制重建索引的方法,并展示了如何查询插件信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查看ES健康状态

curl localhost:9200/_cluster/health?pretty

curl localhost:9200/_cluster/state?pretty

查看ES集群的设置

curl localhost:9200/_cluster/settings?pretty

查看ES在线的节点

curl localhost:9200/_cat/nodes?v
#查看主节点
curl localhost:9200/_cat/master

查看索引

curl localhost:9200/_cat/indices?v
#具体索引
curl localhost:9200/_cat/indices/{index}

查看分片

curl localhost:9200/_cat/shards
curl localhost:9200/_cat/shards/{index}

动态修改副本数(单节点可设置为0)

curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/_settings' -d '
 {
     "index" : {
        "number_of_replicas" : 0
     }
 }'

复制、重建索引

curl  -XPOST localhost:9200/_reindex -d '{
    "source":{
        "index":"message"
    },
    "dest":{
        "index":"new_message"
    }
}'

查询插件信息

curl localhost:9200/_cat/plugins

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值