elasticsearch特殊命令-创新互联

  1. 重置备份

    成都创新互联自2013年创立以来,先为翔安等服务建站,翔安等地企业,进行企业商务咨询服务。为翔安企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

    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

             }

           }

        ]

   }'

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文名称:elasticsearch特殊命令-创新互联
文章源于:http://scyanting.com/article/cdgcgc.html