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 Steve Pruitt <bp...@opentext.com> on 2017/12/04 14:33:57 UTC

RE: [EXTERNAL] - Re: starting SolrCloud nodes

Thanks.

I edited /etc/default/solr.in.sh to list my ZK hosts and I uncommented ZK_CLIENT_TIMEOUT leaving the default value of 15000.
I am not sure if I need to set the SOLR_HOST.  This is not a production install, but I am running with three ZK machines and three Solr machines in the cluster.
The comment states to use it to "exposed to cluster state".  I'm not sure what "cluster state" means exactly and not sure if the default localhost is ok.

-S

-----Original Message-----
From: Shawn Heisey [mailto:apache@elyograg.org] 
Sent: Friday, December 01, 2017 6:34 PM
To: solr-user@lucene.apache.org
Subject: [EXTERNAL] - Re: starting SolrCloud nodes

On 12/1/2017 10:13 AM, Steve Pruitt wrote:
> Thanks to previous help.  I have a ZK ensemble of three nodes running.  I have uploaded the config for my collection and the solr.xml file.
> I have Solr installed on three machines.
>
> I think my next steps are:
>
> Start up each Solr instance:  bin/solr start -c -z "zoo1:2181,zoo2:2181,zoo3:2181"  // I have ZK_Hosts set to my ZK's, but the documentation seems to say I need to provide the list here to prevent embedded ZK from getting used.

The embedded ZK will only get started if you use the -c option and there is no ZK_HOST variable and no -z option on the commandline.

If you use both -z and ZK_HOST, then the info I've seen says the -z option will take priority.  I haven't looked at the script closely enough to confirm, but that would be the most logical way to operate, so it's probably correct.

If ZK_HOST is defined or you use the -z option, you do not need to include the -c option when starting Solr.  SolrCloud mode is assumed when ZK info is available.  The only time the -c option is *required* is when you want to start the embedded zookeeper.  Having the option won't hurt anything, though.

To start a solr *service* in cloud mode, all you need is to add ZK_HOST to /etc/default/XXXX.in.sh, where XXXX is the service name, which defaults to solr.

> From one of the Solr instances create a collection:
> bin/solr create -c nameofuploadedconfig -s 3 -rf 2     //for example.

Nitpick:  The -c option on the create command is the name of the collection.  To specify the name of the uploaded config, if it happens to be different from the collection name, use the -n option.  You can use the -d option to point at a config on disk, and it will be uploaded to a config in zookeeper named after the -n option or the collection. The collection name and the config name are not required to match.  You can use the same config for multiple collections.

> The documentation I think implies that all of the Solr instances are automatically set with the collection.  There is no further action at this point?

Solr will make an automatic decision as to which nodes will be used to hold the collection.  If you use the Collections API directly rather than the commandline, you can give Solr an explicit list of nodes to use.  Without the explicit list, Solr will spread the collection across the cluster as widely as it can.

https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.apache.org_solr_guide_6-5F6_collections-2Dapi.html-23CollectionsAPI-2Dcreate&d=DwIDaQ&c=ZgVRmm3mf2P1-XDAyDsu4A&r=ksx9qnQFG3QvxkP54EBPEzv1HHDjlk-MFO-7EONGCtY&m=y01KP5ZxH3grjfa0RoKxcEYEdhqcrmPikTmVLbotY6g&s=fnzfx6DkM_sSrLrRbVVxXceLNfqCC_w7eiiASQsG9S8&e=

The "bin/solr create" command, when used on SolrCloud, just makes an HTTP request to the Collections API, unless you use the -d option, in which case it will upload a config to zookeeper before calling the Collections API.

Thanks,
Shawn


Re: [EXTERNAL] - Re: starting SolrCloud nodes

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/4/2017 7:33 AM, Steve Pruitt wrote:
> I edited /etc/default/solr.in.sh to list my ZK hosts and I uncommented ZK_CLIENT_TIMEOUT leaving the default value of 15000.

The default is 15 seconds, most of the example configs that Solr 
includes have it increased to 30 seconds.  IMHO, 15 seconds is a 
relative eternity.

> I am not sure if I need to set the SOLR_HOST.  This is not a production install, but I am running with three ZK machines and three Solr machines in the cluster.
> The comment states to use it to "exposed to cluster state".  I'm not sure what "cluster state" means exactly and not sure if the default localhost is ok.

SOLR_HOST is used to decide what hostname each Solr instance will use 
when it registers itself into ZK, so that the cloud client (or the cloud 
itself) can find all the hosts for load balancing or distributed requests.

If you don't define this, Solr will use Java APIs to figure out the 
primary IP address of the machine, and it will use that when registering 
itself into the SolrCloud clusterstate in ZK.  Sometimes the Java APIs 
will choose the wrong address, especially on multi-homed systems, which 
is why Solr provides a way to manually declare the hostname.

Thanks,
Shawn