Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Solr 6 cores?

Tags:

linux

solr

solr6

I've installed Solr 6 on a Digital Ocean ubuntu instance:

install_solr_service.sh solr-6.1.0.tgz

and verified that Solr is running. However, I cannot create any cores, either through the UI or at the command line. I've tried various different permutations of:

sudo ./solr create -c netest

including

sudo ./solr create -c netest -d /opt/solr/server/solr/configsets/basic_configs/conf/

but it always gives me:

ERROR: Error CREATEing SolrCore 'netest': Unable to create core [netest] Caused by: /var/solr/data/netest/data

If I create the directory in advance:

sudo mkdir /var/solr/data/netest/
sudo mkdir /var/solr/data/netest/data
sudo chown -R solr:solr /var/solr/data

when I rerun the create command I get:

ERROR: Error CREATEing SolrCore 'netest': Unable to create core [netest] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/var/solr/data/netest'

If I copy solrconfig.xml into the directory and run the command again I get:

ERROR: Error CREATEing SolrCore 'netest': Unable to create core [netest] Caused by: Can't find resource 'schema.xml' in classpath or '/var/solr/data/netest'

and I'm stuck at this stage as google isn't helping me find where to get or create the schema.xml file.

Can anyone help?

like image 956
Paul Grenyer Avatar asked Jul 17 '16 18:07

Paul Grenyer


People also ask

How do I add cores to Solr cloud?

Cores can be created using bin/solr script or as part of SolrCloud collection creation using the APIs. Core-specific properties (such as the directories to use for the indexes or configuration files, the core name, and other options) are defined in a core. properties file. Any core.

What are cores in Solr?

In Solr, the term core is used to refer to a single index and associated transaction log and configuration files (including the solrconfig. xml and Schema files, among others).


2 Answers

Try this way

Navigate to Solr/solr-6.1.0/server/solr/

create new folder and name it netest.

copy conf folder from Solr/solr-6.1.0/server/solr/configsets/basic_configs/ and paste it inside netest folder.

now you enter this command on terminal sudo ./solr create -c netest

This will create newcore with name netest using config files inside conf folder

hope this helps

like image 125
Vinod Avatar answered Oct 19 '22 23:10

Vinod


You shouldn't use root, but solr user privileges to create Solr cores since data folder (e.g. /var/solr/data) is usually owned by solr. Secondly please note that provided solr shell script is still using the Solr Admin UI as the main starting point for administering Solr.

So try the following commands:

cd /opt/solr
sudo -u solr ./bin/solr create -c netest
sudo ls -la /var/solr/data

For any other problems, please double check that:

  • Solr is accessible via Admin UI (e.g. curl -s http://localhost:8983/solr/ or links).
  • jar command is accessible (it is in your PATH).
  • For syntax, run: bin/solr --help in your Solr HOME folder.

For troubleshooting, 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.

like image 20
kenorb Avatar answered Oct 19 '22 22:10

kenorb