TheGeekBETA
TheGeekBETA

Reputation: 33

Solr clusterstate.json corrupted. Manual restore possible?

I am stuck with having null value for the range in clusterstate.json (attached below)

"shard5":{
        "range":null,
        "state":"active",
        "replicas":{"core_node1":{
            "state":"active",
            "core":"Web_shard5_replica1",
            "node_name":"domain-name.com:1981_solr",
            "base_url":"http://domain-name.com:1981/solr",
            "leader":"true"}}}},
    "router":"compositeId"},

I tried to use zookeeper cli to change this, but it was not able to. I tried to locate this file, but didn't find it anywhere.

Can you please let me know how do i change the range from null to something meaningful? i have the range that i need, so if i can find the file, maybe i can change it manually.

My next question is - can we have a catch all for ranges, i mean if things don't match any other range then insert in this shard..is this possible?

Kindly advice.

Upvotes: 0

Views: 3345

Answers (2)

Greg S
Greg S

Reputation: 544

Here is an example of manually editing and updating clusterstate.json in zookeeper using zkcli.sh provided with Solr.

  1. Download clusterstate.json:

    zkcli.sh -z zk-host-name -cmd getfile /clusterstate.json clusterstateLoca.json

  2. Edit the downloaded closterstateLocal.json and save it

  3. Remove stale clusterstate.json from ZK

    zkcli.sh -z zk-host-name -cmd clear /clusterstate.json

  4. Upload modified clusterstate.json to ZK:

    zkcli.sh -z zk-host-name -cmd putfile /clusterstate.json ./clusterstateLocal.json

Upvotes: 1

TheGeekBETA
TheGeekBETA

Reputation: 33

I resolved the above problem by creating duplicate shards (replicas) & used the below for its creation -

http://domain-name.com:1981/solr/admin/collections?action=CREATE&name=image&numShards=5&replicationFactor=2&maxShardsPerNode=2

Maybe it will help someone else as well....I have a custom ranking algorithm not sure if that is the thing that influenced this, but then it seems solved now

Upvotes: 0

Related Questions