10

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?

kenorb
  • 155,785
  • 88
  • 678
  • 743
Paul Grenyer
  • 1,713
  • 3
  • 30
  • 51
  • The chown-line doesn't match the other lines - and is /var/solr owned by the solr user? (and otherwise empty when issuing the first create command?) .. and you can find [more about schema.xml](http://solr.pl/en/2010/08/16/what-is-schema-xml/) if you google 'schema.xml solr' – MatsLindh Jul 17 '16 at 22:10
  • Thanks. The chown-line was a typo in the question. Yes, /var/solr is owned by the solr user, no it's not empty (data log4j.properties logs solr-8983.pid solrconfig.xml). I'll take a look at the schema link. – Paul Grenyer Jul 18 '16 at 05:49
  • 1
    Possible duplicate of [Error CREATEing SolrCore 'gettingstarted': Unable to create core \[gettingstarted\] Caused by: /var/solr/data/gettingstarted/data](http://stackoverflow.com/questions/33851416/error-createing-solrcore-gettingstarted-unable-to-create-core-gettingstarted) – kenorb Mar 26 '17 at 18:17

6 Answers6

20

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

Vinod
  • 1,965
  • 1
  • 9
  • 18
  • 1
    i was also about to give that answer only !! Its kind of a mystery in Solr 6 :) . Vinod if we have to create cores like this only, then what is the use of rest call that claims to create cores dynamically . It cannot if we dont make a set up like this ?? what is your comment on that ? – Saurabh Chaturvedi Jul 18 '16 at 08:57
  • 1
    @codechat `bin/solr create -c new_core` this command actually works. I mean I didn't create folder with name new_core with conf folder inside it. But I too got same error with `sudo` so I suggested to create folder with corename. I am not sure if this error because of using superdo `sudo`. Have to check about that , please update me if you get information. – Vinod Jul 18 '16 at 09:50
  • 2
    This works also for Solr 7.x, except that basic_config is now called _default – fyr Sep 22 '18 at 18:19
  • For me, copying folder conf from "C:\...\solr-8.9.0\solr-8.9.0\server\solr\configsets\sample_techproducts_configs" worked – Shivanshu Jun 30 '21 at 08:04
6

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.

kenorb
  • 155,785
  • 88
  • 678
  • 743
2

Its permission issue, so try to create a new core using below command, and it will work!

sudo -u solr bin/solr create -c demo
kenorb
  • 155,785
  • 88
  • 678
  • 743
Kiran
  • 1,176
  • 2
  • 14
  • 27
0

If you have created schema.xml and solrconfig.xml in your core directory, try Add Core from core admin page, it should work.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Manish Nakar
  • 4,286
  • 1
  • 18
  • 13
0

./solr create_core -c netest -d basic_configs

Usman
  • 949
  • 9
  • 12
0
su - solr -c "/opt/solr/bin/solr create -c testcore -n 
data_driven_schema_configs"

This command works for me in solr 6.60 with the sudo user.

Ramkumar
  • 43
  • 1
  • 6