18 April 2019

See this article if you haven’t already set up Zookeeper for SolrCloud.
Liferay also has documentation for setting up Solr and SolrCloud. I found this documentation good for the former and not so good for the latter. Starting at step 4 I found their way confusing and chose a different path.
I will place the first three steps in this article as well in case the original content is moved/removed.

First you want to follow Liferay instructions to setup a standalone Solr server. If you have never setup Solr before this is recommended. It gives you a feel for how Solr should work. The key takeaways is you create a configuration in Solr for liferay by copying the default Solr configuration and overwriting some of its files with files from the Liferay Connector to Solr 7 package. The package can be found on the Liferay Marketplace.

  1. Stop the Solr server if it’s running.
  2. Navigate to the Solr_Home/configsets folder and create a folder called liferay_configs
  3. Copy the conf folder from Solr_Home/liferay to the liferay_configs folder you just created. The configset/liferay_configs folder contains the SolrCloud Liferay Portal collection configuration and is uploaded to ZooKeeper. By copying the conf folder from the liferay server configured earlier, you’re using the schema.xml and solrconfig.xml files provided with the Liferay Solr Adapter.
The recommended step of using a wizard, hid to much. Plus its starts two instance of Solr on one server/VM. Giving each one a different port. I used the a different command to load a collection configuration into Zookeeper. First we need to update ZK_HOST in the solr.in.sh file. Using the same configuration from our Zookeeper article (link above) we add our nodes to the entry. /your/directory/path/solr/bin/solr.in.sh
#Stuff omitted here
# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
 52 # e.g. host1:2181,host2:2181/chroot
 53 # Leave empty if not using SolrCloud
 54 ZK_HOST=",,,"
#Stuff omitted here

Now we run our command to load the configset as a collection we made when we followed the Liferay directions.

  $ ./solr create -c liferay -d liferay_configs

When I started the Solr Instance using:

  $ ./solr start -c 

I received the following errors in the log files

2019-04-17 17:38:18.678 ERROR (coreLoadExecutor-13-thread-1-processing-n: [c:liferay   x:liferay] o.a.s.c     .CoreContainer Could not repair coreNodeName in core.properties file for core liferay
  2019-04-17 17:38:18.678 ERROR (coreLoadExecutor-13-thread-1-processing-n: [c:liferay   x:liferay] o.a.s.c     .ZkController
  org.apache.solr.common.SolrException: No coreNodeName for CoreDescriptor[name=liferay;instanceDir=/apps01/solr/server/solr/liferay]
    at org.apache.solr.cloud.ZkController.checkStateInZk(ZkController.java:1829) ~[solr-core-7.7.1.jar:7.7.1 5bf96d32f88eb8a2f5e77533     9885cd6ba84a3b58 - ishan - 2019-02-23 02:39:07]
    at org.apache.solr.cloud.ZkController.preRegister(ZkController.java:1767) ~[solr-core-7.7.1.jar:7.7.1 5bf96d32f88eb8a2f5e77533988     5cd6ba84a3b58 - ishan - 2019-02-23 02:39:07]
    at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1171) ~[solr-core-7.7.1.jar:7.7.1 5bf96d32f88eb8a2f     5e775339885cd6ba84a3b58 - ishan - 2019-02-23 02:39:07]
    at org.apache.solr.core.CoreContainer.lambda$load$13(CoreContainer.java:690) ~[solr-core-7.7.1.jar:7.7.1 5bf96d32f88eb8a2f5e77533     9885cd6ba84a3b58 - ishan - 2019-02-23 02:39:07]
    at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197) ~[metrics-cor     e-3.2.6.jar:3.2.6]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_201]
    at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:209) ~[solr-solrj-7.7.1     .jar:7.7.1 5bf96d32f88eb8a2f5e775339885cd6ba84a3b58 - ishan - 2019-02-23 02:39:09]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]

I was able to correct this problem with the command below after reading <a href="https://lucene.apache.org/solr/guide/7_0/major-changes-in-solr-7.html">Major Changes in Solr 7</a>

<span class="codeCaption prettyprint">/your/directory/path/solr/server/scripts/cloud-scripts</span><pre class="terminal">

$ ./zkcli.sh -zkhost localhost:9983 -cmd clusterprop -name legacyCloud -val true

After that change I was able to start Solr in cloud mode and it worked without error.

Less Is More ~ Older posts are available in the archive.