首页 > 其他 > 详细

elasticsearch 特殊命令

时间:2017-03-05 00:47:05      阅读:580      评论:0      收藏:0      [点我收藏+]
  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/company -d‘

{

  "settings" : {

    "refresh_interval": "-1"

  }

}‘

大批量插入之后改回1


4. 索引别名

 

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

    {

        "actions": [

            {"remove": {"index": "company", "alias": "company_alia"}},

            {"add": {"index":"company ", "alias": " company_alia_bak"}}

        ]

    }‘


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

              }

            }

        ]

    }‘


本文出自 “12587095” 博客,请务必保留此出处http://12597095.blog.51cto.com/12587095/1903268

elasticsearch 特殊命令

原文:http://12597095.blog.51cto.com/12587095/1903268

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!