issues making default collection for solr - 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

Related

Download Solr Collection config from specific directory on ZK

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.

Solr Error: Unable to create core [mycore] Caused by solr.ICUCollationField

I am trying to create a solr core, I am using drupalvm with vagrant and virtual box.
When setting up solr with this command:
sudo su - solr -c "/opt/solr/bin/solr create -c m4m -d /tmp/search_api_solr/solr-conf/7.x/"
I am getting this error:
INFO - 2018-11-05 19:21:45.804; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
ERROR: Error CREATEing SolrCore 'mycore': Unable to create core [mycore] Caused by: solr.ICUCollationField
Creating a core without specifying the -d <confdir> option is successful but gives me some really weird errors in the solr dashboard and Drupal UI which research indicates has something to do with a corrupted core.
Any help with why I am getting this error would be much appreciated. Other developers using the same vagrant installation is running without issue.
If you create the core without the config directory, solr will use it's default configurations.
Which in turn, will have none of the drupal needed field definitions, and so forth.
What you need to do, if you know a little bit about the solr's structure, and if you use solr > version 7 is:
go to where your solr installation is
cd /PATH_TO_SOLR/server/solr-webapp/webapp/WEB-INF/lib
Copy all jars from the analysis-extras folder to your wEB-INF/lib folder
cp /PATH_TO_SOLR/contrib/analysis-extras/lib/*.jar ./
restart solr the way you normally do, specifying your -d config directory. That's important.
Hope this helps.
OR...
Save your hassle and let the pros handle all this for you with a SaaS such as the likes of https://opensolr.com
You can create your solr index with 1 click, and you need 2 more clicks to upload your config files and you're done.
I need jars from 2 directories:
cd /PATH_TO_SOLR
cp solr/contrib/analysis-extras/lib/*.jar solr/server/solr-webapp/webapp/WEB-INF/lib/
cp solr/contrib/analysis-extras/lucene-libs/*.jar solr/server/solr-webapp/webapp/WEB-INF/lib/
see solr/contrib/analysis-extras/README.txt

Why can I not create a core when running a 2nd Apache Solr instance?

My first instance:
sudo bin/solr start -p 8983 -s ../coaps
My second instance:
sudo bin/solr start -p 8984 -s ../newcoaps
Using the python http utility I verified connections:
http :8983/solr/
http :8984/solr/
I can ping my first one with :8983/solr/samos/admin/ping/ but I can NOT ping the other one because the core located in ../newcoaps is not added upon startup.
The ../newcoaps directory looks like this before I started up Solr:
ls -R ../newcoaps/
../newcoaps/:
samos solr.xml
../newcoaps/samos:
conf data
../newcoaps/samos/conf:
schema.xml solrconfig.xml
../newcoaps/samos/data:
I copied the files in here directly from my other instance, which is running smoothly. Everything is default except for several fields I defined.
In the web browser, I see that the second instance has no cores, so I tried to add it manually but I get this response:
Error CREATEing SolrCore 'new_core': Unable to create core [new_core] Caused by: Can't find resource 'synonyms.txt' in classpath or '/opt/solr/newcoaps/samos'
What is going on here and why is that file important enough to prevent me from adding this core? What steps can I take to figuring out a solution to this problem?
Your schema (schema.xml) is referencing the synonyms.txt file (in a SynonymFilter definition). Remove the filter from the configuration if you're not expanding synonyms, or create an empty file named synonyms.txt to allow the core to start up.
As a possible explanation: If you started the first node without a schema.xml present the first time, it might have switched to using the managed schema functionality instead of reading the schema.xml, but when starting the second node with the schema present, it'll try to read and parse it.

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