Elastic search 클러스터관리

  • View
    377

  • Download
    0

Embed Size (px)

Transcript

  • Elastic search cecil

  • Contents

    & API

  • (1/2)

    API : _snapshot

    curl -XPUT localhost:9200/_snapshot/backup -d '{ "type": "fs", "settings": { "location": "/tmp/es_backup_folder/cluster1" } } # config path.repo: []

  • (2/2)

    # curl -XPUT localhost:9200/_snapshot/backup/bckp1

    # curl -XPOST localhost:9200/_snapshot/backup/bckp1/_restore

    # curl -XDELETE 'localhost:9200/_snapshot/backup/bckp1?pretty'

  • (1/3)

    # API curl 'localhost:9200/_cluster/health?pretty'

    - status: Green(), Yellow( ), red( X)

    # API curl localhost:9200/library,map/_stats?pretty

    - docs: - store: - indexing, get, search: API

  • (2/3)

    # API curl localhost:9200/_nodes//os,jvm,plugins?pretty'

    # API curl localhost:9200/_nodes//stats/os,jvm,breaker?pretty'

    # API curl 'localhost:9200/_cluster/state?pretty'

  • (3/3)

    # curl localhost:9200/_cluster/pending_tasks?pretty

    # API curl localhost:9200/_segments?pretty'

    # cat API: json curl localhost:9200/_cat/shards?v

  • cluster.routing.allocation.allow_rebalance

    : always, indices_primaryies_active, indics_all_active

    cluster.routing.allocation.cluster_concurrent_rebalance

    , 2

    cluster.routing.allocation.node_concurrent_recoveries

    , 2

    cluster.routing.allocation.node_initial_primaries_recoveries

    cluster.routing.allocation.enable

    : all, primaries, new_primaries, none

    indices.recovery.concurrent_streams

  • (1/4)

    # # node.zone # curl -XPUT 'http://localhost:9200/shop' -d '{ "settings" : { "index" : {

    "routing.allocation.include.zone" : "zone_one" }

    }

    }'

  • (2/4)

    # curl -XPUT 'http://localhost:9200/promotions/_settings' -d '{ index.routing.allocation.include.zone": "zone_one,zone_two"

    }' # curl -XPUT 'localhost:9200/pictures/_settings' -d '{ "index.routing.allocation.exclude.zone" : "zone_one"

    }'

  • (3/4)# (node.size) curl -XPUT 'localhost:9200/pictures/_settings' -d '{ "index.routing.allocation.require.size" : "big_node", "index.routing.allocation.require.zone" : "zone_one"

    }'

    # IP

    curl -XPUT 'localhost:9200/shop/_settings' -d '{ "index.routing.allocation.include._ip" : "10.1.2.10,10.1.2.11"

    }'

    # ( ip )

    #

  • (4/4)# curl -XPOST 'localhost:9200/_cluster/reroute' -d '{ "commands" : [ { "move" : { "index" : "shop", "shard" : 1, "from_node" : "es_node_one", "to_node" : "es_node_two"

    } }]

    }'

    # :

    # :

  • # , IO . curl -XPUT 'localhost:9200/library/_warmer/tags_warming_query' -d '{

    "query" : { "match_all" : {}

    }, "facets" : {

    "warming_facet" : { "terms" : {

    "field" : "tags" }}}} # / curl -XPUT 'http://localhost:9200/library/_settings' -d '{ "index.warmer.enabled" : false }'

  • #

    # N():1(), 1():N()

    # 1():N() GEt

    #

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

    "actions" : [

    { "add" : { "index" : "day10", "alias" : "week12" } },

    { "add" : { "index" : "day11", "alias" : "week12" } },

    { "add" : { "index" : "day12", "alias" : "week12" } }

    ] }'

    #

    curl -XGET localhost:9200/day10,day11,day12 -> (week12)/_search?q=test

  • & API#

    bin/plugin -install elasticsearch/elasticsearch-lang-javascript/

    2.0.0.RC1

    #

    bin/plugin -remove river-mongodb

    # API

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

    "transient" : {

    "PROPERTY_NAME" : "PROPERTY_VALUE"

    }

    }'

  • Q&A

  • References Rafat Kuc., Marek Rogozinski., Elasticsearch ( ). : (), 2014

    , ! . : , 2015