Download Solr Collection config from specific directory on ZK - solr

We have Solr collections' config details in a specific directory on Zookeeper. Below is the directory structure on zookeeper;
|--app_dir
|--dev
|--configs
|--collection_name
|--conf
I am trying to download the configuration of collections using downconfig utility. Following is the command I am using;
bin/solr zk downconfig -n conf_name -d /home/ec2-user/solr-8.1.0/server/solr/configsets -z zk-dev-1:2181,zk-dev-2:2181,zk-dev-3:2181
The command fails to execute with below error,
ERROR: Error downloading files from zookeeper path /configs/test_vector to /home/ec2-user/solr-8.1.0/server/solr/configsets/conf
ERROR - 2020-09-30 15:11:23.778; org.apache.solr.util.SolrCLI; Could not complete downconfig operation for reason: Error downloading files from zookeeper path /configs/test_vector to /home/ec2-user/solr-8.1.0/server/solr/configsets/conf
I suspect the path for config is incorrect as the actual path is app_name/dev/configs/collection_name while the error suggests the path is only configs/collection_name but I am not sure if that's the error.
Appreciate the help!

If you're not using the default /solr path inside ZK, you should be able to change it using
-zkhost 127.0.0.1:2181/app_dir/dev
This is also required for any configuration of a SolrCloud compatible (i.e. Zookeeper-aware) client or other operations that interact with Zookeeper.

Related

issues making default collection for solr

I am trying to install solr so that my data catalog could use it. To do so, I used these steps which are mentioned on the documentation of my data portal:
cd solr/solr-config
wget http://apache.crihan.fr/dist/lucene/solr/6.0.0/solr-6.0.0.tgz
tar xvfz solr-6.0.0.tgz
solr-6.0.0/bin/solr start -c -p 8984
solr-6.0.0/bin/solr create -p 8984 -c catalog_srv -d src/main/solr-cores/catalog
accourding to these instructions I made a directory /opt/solr/solr-config the downloaded and unziped solr, and started it on port 8984. Now I don't understand how does the last command works. what should be the second path src/main/solr-cores/catalog? I thought I should generatet the directories src, main solr-cores and catalog inside my solr-config directory and then run this command. but I got errors that solrconfig.xml could not be found. after adding solrconfig.xml to /opt/solr/solr-config/src/main/solr-cores/catalog, now I get an error:
ERROR: Failed to create collection 'catalog_srv' due to: {127.0.1.1:8984_solr=org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at http://127.0.1.1:8984/solr: Error CREATEing SolrCore 'catalog_srv_shard1_replica1': Unable to create core [catalog_srv_shard1_replica1] Caused by: Can't find resource 'schema.xml' in classpath or '/configs/catalog_srv', cwd=/opt/solr/solr-config/solr-6.6.0/server}
what is schema.xml? is it something about data of my data portal? could you please explain the issue and how should I determine the path src/main/solr-cores/catalog to avoid these errors? what does exactly a default collection of solr do?
More info: my data portal is an opensource software called geonetwork and the documentation about solr is here: http://geonetwork-opensource.org/manuals/trunk/eng/users/maintainer-guide/installing/installing-solr.html?highlight=solr

Error when creating a core by specifying a config directory

I am attempting to create a core in SolrCloud using the following command:
sudo /opt/solr/bin/solr create -c Collection1 -d /home/callmekatootie/Desktop/conf
However, I get the following error:
Connecting to ZooKeeper at localhost:9983 ...
Uploading /home/callmekatootie/Desktop/vm/configs for config Collection1
to ZooKeeper at localhost:9983
Creating new collection 'Collection1' using command:
http://localhost:8983/solr/admin/collections?action=CREATE&name=Collection1
&numShards=1&replicationFactor=1&maxShardsPerNode=1
&collection.configName=Collection1
ERROR: Failed to create collection 'Collection1' due to: org.apache.solr.client.
solrj.impl.HttpSolrClient$RemoteSolrException:Error from server at
http://127.0.1.1:8983/solr: Error CREATEing SolrCore 'Collection1_shard1_replica1':
Unable to create core [Collection1_shard1_replica1]
Caused by: solr.SynonymExpandingExtendedDismaxQParserPlugin
What is the SynonymExpandingExtendedDismaxQParserPlugin and why am I getting the above error
Found the cause of the issue.
Turns out that SynonymExpandingExtendedDismaxQParserPlugin is an actual plugin that was being used in the SolrConfig.xml present in the configuration files that I was uploading.
This plugin was available through https://github.com/healthonnet/hon-lucene-synonyms which I had to copy to /opt/solr/server/solr-webapp/webapp/WEB-INF/lib/ folder - I had to paste that jar file in this folder. I restarted Solr and then managed to execute the mentioned command successfully.

Solr 5: Adding a new Core fails out of the box

So I'm just playing around with Solr 5, but I tried to add a new Core through the Admin UI and the command line with:
bin/solr create -c new_core
But in both situations I get the following error:
new_core: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core new_core: Error loading solr config from /Users/blah/lib/solr-5.3.0/server/solr/new_core/conf/solrconfig.xml
I started my Solr server using this:
bin/solr start
I'm following the docs here:
https://cwiki.apache.org/confluence/display/solr/Running+Solr
So what's the fix? How was this supposed to work out of the box given I assume there must be some template that the Admin UI uses when creating new cores?
The error is coming because there is no new_core configured in your setup.
Please perform the following steps:
mkdir /Users/blah/lib/solr-5.3.0/server/solr/core_name
echo "name=core_name" > /Users/blah/lib/solr-5.3.0/server/solr/core_name/core.properties
cp -r /Users/blah/lib/solr-5.3.0/server/solr/configsets/basic_configs/conf /Users/blah/lib/solr-5.3.0/server/solr/core_name/
Some important point to note:
core.properties and conf directory should be placed at same path.
conf directory will contain the schema.xml and solrconfig.xml files.

How to create new core in Solr 5?

Currently we are using Apache Solr 4.10.3 OR Heliosearch Distribution for Solr [HDS] as a search engine to index our data.
Now after that, I got the news about Apache Solr 5.0.0 release in last month. I'd successfully installed Apache Solr 5.0.0 version and now its running properly on 8983 port (means only running solr but unable to create core). In that UI, I'm unable to find the example core as well as schema or config files under it. So, I started creating new core as we create in old versions but unable to create one. Following is the error, I'm getting it:
Error CREATEing SolrCore 'testcore1': Unable to create core [testcore1] Caused by: Could not find configName for collection testcore1 found:null
Note: I also seen Cloud tab on (ie. http://localhost:8983/solr/) left side of Solr UI and also don't know how it works? Meaning I don't know the location of the schema.xml, solrconfig.xml files due to lack of example folder (Collection1) and how to update those files?
Is there any useful document or solution available to solve this error?
In Solr 5, creation of cores is supported by the bin/solr script provided in the distribution. Try
bin/solr create -help
for a quick introduction.
From the above help doc, you may find:
bin/solr create [-c name] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port]
In Solr 5.4.0 , create new core using command from Solr-5.x.x folder (Solr Installation folder) like following,
$ bin/solr create -c <name>
See this documentation of Apache Solr 5.4 https://cwiki.apache.org/confluence/display/solr/Running+Solr
{SOLR_INSTALLATION}/server/solr/configsets\basic_configs\conf
you can find the example schema.xml and solrconfig.xml.
if you want to create the new core
{SOLR_INSTALLATION}/server/solr/{new core name} folder and create conf folder with required schema and solrconfig.xml and blank core.properties file.
you can find the examples for schema and config in
{SOLR_INSTALLATION}/example/example-DIH/solr
Create using the web interface
Go to bin directory and issue
./solr start -e cloud -noprompt
Which will start solr.
Go to http://localhost:8983
(this is assuming you are running on localhost)
Click on core admin and they "Add Core"
Use provided solr script with solr user privileges to create Solr cores, e.g.
cd /opt/solr
sudo -u solr ./bin/solr create -c testcore1
Run bin/solr --help for syntax guidance.
For any other issues, please check your Solr logs (e.g. /var/solr/logs/solr.log).
Related: SOLR-7826: Permission issues when creating cores with bin/solr as root user.
You can find your solrconfig.xml and schema.xml inside the collection directory.
Go to /usr/lib/ambari-infra-solr/server/solr and u will see a folder with same name as of collection and with schema and config files.
Inside the conf folder there will be a managed-schema file and other files that you have been searching for.
As for this error
Error CREATEing SolrCore 'testcore1': Unable to create core [testcore1] Caused by: Could not find configName for collection testcore1 found:null
This error must be coming when you are creating solr collection from UI.
For that go to location where solr.cmd is located and type the below code
./solr create -c -d -s -r
copy conf from solr/example/conf to solr/server/solr/.

Fail to load ExtractingRequestHandler when running the Solr Quickstart Tutorial

I installed Solr 5.0.0 on OS X 10.10.2 using Homebrew. I am trying to follow the quick start instructions and am getting errors when I try to index a directory of files.
I am able to successfully start the sample Solr server by running
bin/solr start -e cloud -noprompt
as directed by the tutorial. I then try to index a directory of files by running
./bin/post -c gettingstarted docs/
(Note that this has to be done from the libexec subdirectory of the Solr install root.)
I get a server error 500 for every file it tries to add. The relevant stack:
Caused by: org.apache.solr.common.SolrException: Error loading class 'solr.extraction.ExtractingRequestHandler'
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:492)
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:423)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:559)
at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:632)
at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.createRequestHandler(RequestHandlers.java:326)
at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.getWrappedHandler(RequestHandlers.java:298)
... 30 more
The issue appears to be that ExtractingRequestHandler is not on the classpath.
ExtractingRequestHandler is in the solr-cell-5.0.0.jar.
jar tf dist/solr-cell-5.0.0.jar | grep ExtractingRequestHandler
org/apache/solr/handler/extraction/ExtractingRequestHandler.class
It's not clear to me if it needs to be on the classpath of the command doing the posting or the Solr instance. The answer to this question makes it sound like the latter. However, I tried setting
export CLASSPATH=dist/solr-cell-5.0.0.jar
before trying to index the files and saw the same error.
I don't see anything in the tutorial about how to configure this. What is the error and how do I get past it?
Looks like the problem is incorrect paths in the Solr example configuration. A workaround is to add softlinks from SOLR_ROOT/contrib and dist to the corresponding directories beneath SOLR_ROOT/libexec/contrib
Details here and here.

Resources