You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Eric Parish <er...@sherpaanalytics.com> on 2013/11/22 20:33:38 UTC

removing dead replicas in solrcloud 4.4

My 4.4 sorlcloud cluster has several down replicas that need to be removed. I am looking for a solution to clean them up like the deletereplica api available in 4.6.

Will manually removing the replicas from the clusterstate.json file in zookeeper accomplish my needs?

Thanks,
Eric

Re: removing dead replicas in solrcloud 4.4

Posted by Otis Gospodnetic <ot...@gmail.com>.
Should clusterstate JSON file upload functionality live on Solr admin
pages?  Or is it already there? I recall Grant working on some upload
functionality recently...

Otis
Solr & ElasticSearch Support
http://sematext.com/
On Nov 22, 2013 2:54 PM, "Timothy Potter" <th...@gmail.com> wrote:

> Yes, I've done this ... but I had to build my own utility to update
> clusterstate.json (for reasons I can't recall now). So make your
> changes to clusterstate.json manually and then do something like the
> following with SolrJ:
>
>     public static void updateClusterstateJsonInZk(CloudSolrServer
> cloudSolrServer, CommandLine cli) throws Exception {
>         String updateClusterstateJson =
> cli.getOptionValue("updateClusterstateJson");
>
>         ZkStateReader zkStateReader = cloudSolrServer.getZkStateReader();
>         SolrZkClient zkClient = zkStateReader.getZkClient();
>
>         File jsonFile = new File(updateClusterstateJson);
>         if (!jsonFile.isFile()) {
>             System.err.println(jsonFile.getAbsolutePath()+" not found.");
>             return;
>         }
>
>         byte[] clusterstateJson = readFile(jsonFile);
>
>         // validate the user is passing is valid JSON
>         InputStreamReader bytesReader = new InputStreamReader(new
> ByteArrayInputStream(clusterstateJson), "UTF-8");
>         JSONParser parser = new JSONParser(bytesReader);
>         parser.toString();
>
>         zkClient.setData("/clusterstate.json", clusterstateJson, true);
>         System.out.println("Updated /clusterstate.json with data from
> "+jsonFile.getAbsolutePath());
>     }
>
> On Fri, Nov 22, 2013 at 12:33 PM, Eric Parish
> <er...@sherpaanalytics.com> wrote:
> > My 4.4 sorlcloud cluster has several down replicas that need to be
> removed. I am looking for a solution to clean them up like the
> deletereplica api available in 4.6.
> >
> > Will manually removing the replicas from the clusterstate.json file in
> zookeeper accomplish my needs?
> >
> > Thanks,
> > Eric
>

Re: removing dead replicas in solrcloud 4.4

Posted by Timothy Potter <th...@gmail.com>.
Yes, I've done this ... but I had to build my own utility to update
clusterstate.json (for reasons I can't recall now). So make your
changes to clusterstate.json manually and then do something like the
following with SolrJ:

    public static void updateClusterstateJsonInZk(CloudSolrServer
cloudSolrServer, CommandLine cli) throws Exception {
        String updateClusterstateJson =
cli.getOptionValue("updateClusterstateJson");

        ZkStateReader zkStateReader = cloudSolrServer.getZkStateReader();
        SolrZkClient zkClient = zkStateReader.getZkClient();

        File jsonFile = new File(updateClusterstateJson);
        if (!jsonFile.isFile()) {
            System.err.println(jsonFile.getAbsolutePath()+" not found.");
            return;
        }

        byte[] clusterstateJson = readFile(jsonFile);

        // validate the user is passing is valid JSON
        InputStreamReader bytesReader = new InputStreamReader(new
ByteArrayInputStream(clusterstateJson), "UTF-8");
        JSONParser parser = new JSONParser(bytesReader);
        parser.toString();

        zkClient.setData("/clusterstate.json", clusterstateJson, true);
        System.out.println("Updated /clusterstate.json with data from
"+jsonFile.getAbsolutePath());
    }

On Fri, Nov 22, 2013 at 12:33 PM, Eric Parish
<er...@sherpaanalytics.com> wrote:
> My 4.4 sorlcloud cluster has several down replicas that need to be removed. I am looking for a solution to clean them up like the deletereplica api available in 4.6.
>
> Will manually removing the replicas from the clusterstate.json file in zookeeper accomplish my needs?
>
> Thanks,
> Eric