Search code examples
solrapache-zookeepersolrcloud

How to use upconfig & linkconfig scripts on external zookeeper


I am trying to set up a solrCloud with external zookeeper ensemble of 3 servers and a replicated solr on 2 servers.

Assumed that an external zookeeper should be independent from other storages I can't find out how to set the -solrhome parameter. Is the zookeeper supposed to read data from the worker nodes?

How do you upload the config and link it with target collection?


Solution

  • We had a lot of problems using solr.home so save yourself some stress and just keep your directories how solr likes them by default.

    Example:

    • /example/solr/collection1/conf/schema.xml
    • /example/solr/collection1/conf/solrconfig.xml
    • /example/solr/collection1/core.properties
    • /example/start.jar

    To get your configuration into Zookeeper, get familiar with solr's zkcli.sh script. You want to use this to manage your solr configs. It will create/update the files in ZK under the /configs node.

    ./zkcli.sh -cmd upconfig -confdir /example/solr/collection1/conf -confname collection1 -z 127.0.0.1
    

    After running the upconfig cmd above, the files in /example/solr/collection1/conf will be uploaded to ZK under /configs/collection1.

    Also need to link your config to your collection (creates a node under the /collections node in ZK)

    # only need to link the config once
    ./zkcli.sh -cmd linkconfig -collection collection1 -confname collection1 -z 127.0.0.1
    

    Then you can just start solr like this:

    java -DzkHost=127.0.0.1 -jar start.jar
    

    The other servers in your cloud will now get the configuration from zookeeper! Some more info in a pretty good blog post here: SolrCloud Cluster (Single Collection) Deployment

    Note: 127.0.0.1 is a comma delimited list of your ZK servers and collection1 is your collection