欢迎投稿

今日深度:

solr集群管理,

solr集群管理,


在九个节点上设置三个shard三个replica,指定在每个节点上均匀分配的创建collection方式

curl 'http://localhost:8991/solr/admin/collections?action=CREATE&name='$name'&numShards=3&replicationFactor=1&collection.configName='$name'&createNodeSet=search-1.xxxxxxxxxx.com:8991_solr,search-1.xxxxxxxxxx.com:8992_solr,search-1.xxxxxxxxxx.com:8993_solr'

curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard1&node=search-1.xxxxxxxxxx.com:8991_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard1&node=search-2.xxxxxxxxxx.com:8991_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard1&node=search-3.xxxxxxxxxx.com:8991_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard2&node=search-1.xxxxxxxxxx.com:8992_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard2&node=search-2.xxxxxxxxxx.com:8992_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard2&node=search-3.xxxxxxxxxx.com:8992_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard3&node=search-1.xxxxxxxxxx.com:8993_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard3&node=search-2.xxxxxxxxxx.com:8993_solr'
curl 'http://localhost:8991/solr/admin/collections?action=ADDREPLICA&collection='$name'&shard=shard3&node=search-3.xxxxxxxxxx.com:8993_solr'


curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard1&replica=core_node1'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard1&replica=core_node2'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard1&replica=core_node3'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard2&replica=core_node1'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard2&replica=core_node2'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard2&replica=core_node3'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard3&replica=core_node1'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard3&replica=core_node2'
curl 'http://localhost:8991/solr/admin/collections?action=DELETEREPLICA&collection='$name'&shard=shard3&replica=core_node3'

state.json

{"ext_quest":{
    "shards":{
      "shard1":{
        "range":"80000000-d554ffff",
        "state":"active",
        "replicas":{
          "core_node4":{
            "state":"active",
            "core":"ext_quest_shard1_replica2",
            "node_name":"search-2.xxxxxxxxxx.com:8991_solr",
            "base_url":"http://search-2.xxxxxxxxxx.com:8991/solr"},
          "core_node5":{
            "state":"active",
            "core":"ext_quest_shard1_replica3",
            "node_name":"search-1.xxxxxxxxxx.com:8991_solr",
            "base_url":"http://search-1.xxxxxxxxxx.com:8991/solr"},
          "core_node10":{
            "state":"active",
            "core":"ext_quest_shard1_replica4",
            "node_name":"search-3.xxxxxxxxxx.com:8991_solr",
            "base_url":"http://search-3.xxxxxxxxxx.com:8991/solr",
            "leader":"true"}}},
      "shard2":{
        "range":"d5550000-2aa9ffff",
        "state":"active",
        "replicas":{
          "core_node6":{
            "state":"active",
            "core":"ext_quest_shard2_replica2",
            "node_name":"search-2.xxxxxxxxxx.com:8992_solr",
            "base_url":"http://search-2.xxxxxxxxxx.com:8992/solr"},
          "core_node7":{
            "state":"active",
            "core":"ext_quest_shard2_replica3",
            "node_name":"search-1.xxxxxxxxxx.com:8992_solr",
            "base_url":"http://search-1.xxxxxxxxxx.com:8992/solr"},
          "core_node11":{
            "state":"active",
            "core":"ext_quest_shard2_replica4",
            "node_name":"search-3.xxxxxxxxxx.com:8992_solr",
            "base_url":"http://search-3.xxxxxxxxxx.com:8992/solr",
            "leader":"true"}}},
      "shard3":{
        "range":"2aaa0000-7fffffff",
        "state":"active",
        "replicas":{
          "core_node8":{
            "state":"active",
            "core":"ext_quest_shard3_replica2",
            "node_name":"search-2.xxxxxxxxxx.com:8993_solr",
            "base_url":"http://search-2.xxxxxxxxxx.com:8993/solr"},
          "core_node9":{
            "state":"active",
            "core":"ext_quest_shard3_replica3",
            "node_name":"search-1.xxxxxxxxxx.com:8993_solr",
            "base_url":"http://search-1.xxxxxxxxxx.com:8993/solr"},
          "core_node12":{
            "state":"active",
            "core":"ext_quest_shard3_replica4",
            "node_name":"search-3.xxxxxxxxxx.com:8993_solr",
            "base_url":"http://search-3.xxxxxxxxxx.com:8993/solr",
            "leader":"true"}}}},
    "maxShardsPerNode":"1",
    "router":{"name":"compositeId"},
    "replicationFactor":"1",
    "autoAddReplicas":"false"}}


1. 区分solr实例, core, collection, shard, replica 概念

2. create集合的重要参数, numshard, replicafactor, createnodeset

    addreplica的重要参数 shard(shard1,shard2...), node(search-2.xxxxxxxxxx.com:8993_solr..)
    deletereplica 的重要参数 shard , replica(core_node1,core_node2...)

3. 以上参数对应的value

www.htsjk.Com true http://www.htsjk.com/solr/38632.html NewsArticle solr集群管理, 在九个节点上设置三个shard三个replica,指定在每个节点上均匀分配的创建collection方式 curl 'http://localhost:8991/solr/admin/collections?action=CREATEname='$name'numShards=3replicationFactor=1col...
相关文章
    暂无相关文章
评论暂时关闭