温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

elasticsearch 特殊命令

发布时间:2020-07-03 00:48:55 来源:网络 阅读:771 作者:大海之中 栏目:开发技术
  1. 重置备份


    curl -XPUT "http://localhost:9200/_settings" -d'

    {

      "number_of_replicas" : 2

    }'


2. 安全关闭

  

curl -XPUT http://localhost:9200/_cluster/settings -d'

{

    "transient" : {

        "cluster.routing.allocation.enable" : "none"

    }

}'




curl -XPUT http:// localhost:9200/_cluster/settings -d'

{

    "transient" : {

        "cluster.routing.allocation.enable" : "all"

    }

}'


3. 关闭自动刷新


大批量插入之前

# curl -XPUT http://127.0.0.1:9200/*-d'

{

  "settings" : {

    "refresh_interval": "-1"

  }

}'

大批量插入之后改回1


4. 索引别名

 

curl -XPOST 'http://localhost:9200/_aliases' -d '

    {

        "actions": [

            {"remove": {"index": "*", "alias": "*"}},

            {"add": {"index":"*", "alias": " *"}}

        ]

    }'


5. 手动分配分片

 

分配一个未分配的分片到指定节点。可以指定索引名和分片号。node参数指定分配到那个节点。allow_primary参数可以强制分配主分片,不过这样可能导致数据丢失。

curl -s "http://localhost:9200/_cat/shards" | grep UNASSIGNED

curl 'localhost:9200/_nodes/process?pretty'


curl -XPOST 'localhost:9200/_cluster/reroute' -d '{

        "commands" : [ {

              "allocate" : {

                  "index" : "your_index_name",

                  "shard" : 1 (share index),

                  "node" : "AfUyuXmGTESHXpwi4OExxx(NODE 编码)",

                  "allow_primary" : true

              }

            }

        ]

    }'


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI