Solrcloud multi-core configuration

I have a standalone Solr instance with 4 different cores running fine on an embedded Jetty server. I configured kernels for v4.10.3, but since I upgraded to v5.1 and everything seems to work fine without any changes.

Before starting production, I need to set it up as a Solrcloud installation, initially with two nodes (two different machines) with 1 shard per node (to keep it simple). I tried to get it to work, but I couldn't do it.

I tried to run it like this (I think using start.jar is not the preferred way) after reading that Solr will look for multiple configured kernels in any subfolders (which work for standalone Solr):

java -DzkRun -DnumShards=2 -Dbootstrap_confdir=solr/ -jar start.jar

      

but it didn't work, it didn't find the file it needed solrconfig.xml

.

My Solr directory looks like this: 4 cores Solr folder

My solr.xml file is standard:

<solr>

  <solrcloud>
    <str name="host">${host:}</str>
    <int name="hostPort">${jetty.port:8983}</int>
    <str name="hostContext">${hostContext:solr}</str>
    <int name="zkClientTimeout">${zkClientTimeout:30000}</int>
    <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
  </solrcloud>

  <shardHandlerFactory name="shardHandlerFactory"
    class="HttpShardHandlerFactory">
    <int name="socketTimeout">${socketTimeout:0}</int>
    <int name="connTimeout">${connTimeout:0}</int>
  </shardHandlerFactory>

</solr>

      

Each core looks like this: a core config

And core.properties just has the core name:

name=users

      

My question is:

  • How do I run Solrcloud v5.1 to build 4 cores?
+3


source to share


2 answers


In SolrCloud, every Core you own becomes a Collection .

Each collection will have its own set of files and configuration data.

You can find this helpful Moving a multicore SOLR instance to the cloud

Solr 5.0 (onwards) made some changes on how to create a SolrCloud setup using shards and also add collections, etc.

All of the following are my understanding of the Solr reference. I highly recommend studying it thoroughly. https://cwiki.apache.org/confluence/display/solr/Apache+Solr+Reference+Guide

I am setting up my servers on Linux (CentOS) server, but these steps can also be used to set up solr on Windows system. For example, instead ofsolr.sh

there is a file solr.cmd

Here are the steps I followed to create a simple 2 shard SolrCloud setup.

  • Install the zookeeper ensemble. I am assuming you are trying to use the inline ZK in solr. For a production system, it is highly recommended to create an external ZK ensemble. You can find the steps for installing an external ensemble in this section of the reference manual

  • Download the solr file to a folder /opt

    .

  • Extract only the installation file.

    tar xzf solr-5.0.0.tgz solr-5.0.0/bin/install_solr_service.sh --strip components=2

  • This command will install solr on your system

    sudo bash ./install_solr_service.sh solr-5.0.0.tgz

  • The above command will create a new user named "solr" if it doesn't exist.

  • These are some of the default parameters that it will use. You can view this in /var/solr/solr.in.sh

    . This is an include file where you can specify other options.

        * SOLR_PID_DIR=/var/solr
        * SOLR_HOME=/var/solr/data
        * LOG4J_PROPS=/var/solr/log4j.properties
        * SOLR_LOGS_DIR=/var/solr/logs
        * SOLR_PORT=8983
    
          

  • Launching install_solr_service start

    the above step will start the solr server. Stop the server using service solr stop

    before making any changes below.

  • Change Java heap value

    SOLR_HEAP="3g"

    This will install Xmx and Xms as 3GB. (optional) This variable is not mentioned in the solr.in.sh file in Solr 5.1. Its bug and fixed, will be released in the next version.

  • SOLR_MODE="solrcloud"

    Required

    this is what you need to run solr in cloud mode.

  • ZK_HOST=ZK1:2181,ZK2:2181,ZK3:2181

    Required

    (replace zk with zookeeper hostnames)

  • Running the command install_solr_service.sh

    also creates an init.d file as/etc/init.d/solr

  • This init.d

    script in turn calls the /opt/solr/bin/solr

    script and includes all the variables from/var/solr/solr.in.sh

  • After you have made the above changes, run solr again using service solr start

  • You can check the status with service solr status



Create skins and replicas of collections  - All commands related to shard, collection, copy are now performed using the collections API.

  • Before creating a collection, the config folder must be loaded into ZK. This can be done with the zkcli.sh script in the solr folder (not on zookeeper servers) Folder:/opt/solr/server/scripts/cloud-scripts

  • Command to load confg folder:

sh zkcli.sh -cmd upconfig -zkhost zk1:2181,zk2:2181,zk3:2181 -confname yourconfigname -confdir /var/solr/configs/conf

This command will be executed 4 times for each of the 4 cores, each time changing the path to the conf folder and the configuration name.

  • This will load all config files into a conf folder named "yourconfigname" in zookeeper.

Creating a collection I used the following command to create a new collection.

http://1.1.1.1:8983/solr/admin/collections?action=CREATE&name=yourcollectionname&numShards=2&replicationFactor=1&maxShardsPerNode=1&createNodeSet=1.1.1.1:8983_solr,2.2.2.2:89ameconfigrNcollection.conyame

Happy Search!

+3


source


SolrCloud does not use configuration files stored in the directory conf

. To make your kernels visible in the SolrCloud structure, you need to load the config files into ZooKeeper and keep the file management. All the time a Solr instance appears, it gets the configuration files stored in the ZooKeeper. Thus, your kernels should not have a directory conf

. To download the main config files in ZooKeeper follow the link below and seeUpload a configuration directory



https://cwiki.apache.org/confluence/display/solr/Command+Line+Utilities

+1


source







All Articles