• ES常用维护命令


    1、查看分片分布
    GET _cat/shards?v
    
    2、设置集群节点允许分片数
    GET /_cluster/settings
    {
      "index.routing.allocation.total_shards_per_node":2
    }
    
    3、解除索引只读
    PUT /_all/_settings
    {
      "index.blocks.read_only_allow_delete": null
    }
    
    4、查看索引状态
    GET _cat/indices\?v
    
    5、查看集群健康状态
    GET _cluster/health
    
    6、查看集群运行事件
    GET /_cluster/allocation/explain
    
    7、设置索引副本数为0
     PUT /comunication-iot-2022.09.02/_settings
    {
        "number_of_replicas": 0
    }
    
    8、手动迁移副本
    POST /_cluster/reroute
    {
        "commands" : [
            {
                "move" : {
                    "index" : "micro-service-income-statistics-2022.06.19", "shard" : 0,
                    "from_node" : "es_node7", "to_node" : "es_node2"
                }
            }
        ]
    }
    
    9、设置节点存储水平
    PUT /_cluster/settings
    {
      "persistent": {
        "cluster.routing.allocation.disk.watermark.low": "90%",
        "cluster.routing.allocation.disk.watermark.high": "95%",
        "cluster.info.update.interval": "1m",
        "cluster.routing.allocation.disk.threshold_enabled": true
      }
    }
    
    10、排除节点并迁移索引
    PUT _cluster/settings
    {
      "persistent" : {
        "cluster.routing.allocation.exclude._ip" : "10.5.232.248"
      },
          "transient" :{
          "cluster.routing.allocation.exclude._ip" : "10.5.232.248"
       }
    }
    
    11、取消排除的节点
    PUT _cluster/settings
    {
      "persistent" : {
        "cluster.routing.allocation.exclude._ip" : null
      },
          "transient" :{
          "cluster.routing.allocation.exclude._ip" : null
       }
    }
    
  • 相关阅读:
    MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法
    如何安装mongodb.msi
    jade和ejs两者的特点
    Node.js中的http.request方法的使用说明
    34丨关于Linux网络,你必须知道这些(下)
    33 | 关于 Linux 网络,你必须知道这些(上)
    osi 七层模型 通俗易懂
    32 | 浅谈容器网络
    Linux 三剑客之SED行天下
    js 基本类型与引用类型的区别
  • 原文地址:https://www.cnblogs.com/Dev0ps/p/16655182.html
Copyright © 2020-2023  润新知