Es基本命令

1.暂停集群的shard自动均衡
curl -XPUT http://127.0.0.1:8200/_cluster/settings -d’{“transient”:{“cluster.routing.allocation.enable”:“none”}}’

2.重启启动集群的shard均衡
curl -XPUT http://127.0.0.1:8200/_cluster/settings -d’{“transient”:{“cluster.routing.allocation.enable”:“all”}}’

3.将节点从集群路由策略中排除:(此节点的数据慢慢移动到别的节点去,此节点数据会被移空)
curl -XPUT ‘http://127.0.0.1:8200/_cluster/settings’ -H ‘Conetent-Type:application/json’ -d ‘{“transient”:{“cluster.routing.allocation.exclude._name”:“data1”}}’

4.此时节点已经完全从集群中删除了,可恢复集群路由策略
curl -XPUT ‘http://127.0.0.1:8200/_cluster/settings’ -H ‘Conetent-Type:application/json’ -d ‘{“transient”:{“cluster.routing.allocation.exclude._name”:“null”}}’

5.查看集群信息
1)集群健康
http://127.0.0.1:8200/_cat/health?v
2)集群节点
http://127.0.0.1:8200/_cat/nodes?v
3)分片总数,磁盘百分比等
http://127.0.0.1:8200/_cat/allocation?v
4)查看配置设置
http://127.0.0.1:8200/_cluster/settings
5)查看某一索引的分片分布信息
http://127.0.0.1:8200/_cat/shards/cs分片名

6.更改mapping
1) 新建索引 (mapping为新的)

```powershell
PUT方式 http://127.0.0.1:8200/1008_new

{
  "mappings": {}
 }
    
```

2) 复制原索引数据到新索引上
```powershell
POST方式 http://127.0.0.1:8200/_reindex

{
  "source": {
    "index": "1008"
  },
  "dest": {
    "index": "1008_new"
  }
}
```
3) 删除原索引
```powershell
DELETE方式 http://127.0.0.1:8200/1008
```
4)设置 1008_new索引别名(为原索引的名1008)
```powershell
POST方式 http://127.0.0.1:8200/_aliases

  {
        "actions": [
            {"add": {"index": "1008_new", "alias": "1008"}}
        ]
  }
```
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值