30

I'm getting this error when I try to create a new core in solr.

root@ubuntu:/opt/solr# bin/solr create -c gettingstarted -n data_driven_schema_configs

Setup new core instance directory:
/var/solr/data/gettingstarted

Creating new core 'gettingstarted' using command:
http://localhost:8983/solr/admin/cores?action=CREATE&name=gettingstarted&instanceDir=gettingstarted

Failed to create core 'gettingstarted' due to: Error CREATEing SolrCore 'gettingstarted': Unable to create core [gettingstarted] Caused by: /var/solr/data/gettingstarted/data

Also, if I try to create alternatively, It gives me same error:

root@ubuntu:/opt/solr# bin/solr create -c mycore

Setup new core instance directory:
/var/solr/data/mycore

Creating new core 'mycore' using command:
http://localhost:8983/solr/admin/cores?action=CREATE&name=mycore&instanceDir=mycore

Failed to create core 'mycore' due to: Error CREATEing SolrCore 'mycore': Unable to create core [mycore] Caused by: /var/solr/data/mycore/data

In browser, when I try to access solr admin panel, it displays a notification like:

SolrCore Initialization Failures

opt/solr/example/exampledocs/*.xml: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: /var/solr/data/opt/solr/example/exampledocs/*.xml/data 

snapshot is attached.

enter image description here

1
  • 2
    Did you find the solution? I am having exactly same situation and none of the answer is working
    – Jay Chakra
    Nov 14, 2017 at 16:12

8 Answers 8

55

Since it might help anybody with the same issue, it's indeed caused by permission issues when using root. The script doesn't terminate quickly when executing the command as root and instead creates a piece of the core definition before failing.

So first cleanup the broken core:

bin/solr delete -c mycore

Make sure that no folder(s) linger under /var/solr/data for your mycore core.

Next create the core as the solr user

su -u solr -c "/opt/solr/bin/solr create_core -c mycore"

This time it should succeed

2
  • 2
    I found you can also do a chown -R solr on the /var/solr/data/mycore folder to fix this issue May 4, 2016 at 18:36
  • 8
    Depending on your install the path to the solr script may be different. For me this works: sudo -u solr /opt/solr-5.3.0/bin/solr create -c [core].
    – Lpgfmk
    Jun 6, 2016 at 11:47
18

Don't run solr script as root user (it is not recommended). You should run as solr user, e.g.:

sudo -u solr ./bin/solr create -c mycore
10

I found this as the solution:

sudo su - solr -c "/opt/solr/bin/solr create -c mycore"

More information here: https://www.howtoforge.com/tutorial/how-to-install-and-configure-solr-on-ubuntu-1604/

0
5

Please notice that before creating a core you should make a directory with the same name into :

C:\...\solr-8.3.11\server\solr

Then copy conf folder from examples or the default folder.

I had a same problem in windows I copied conf folder from examples:

C:\...\solr-8.3.1\example\files

to here :

C:\...\solr-8.3.1\server\solr\new_core

And my problem solved.

You can also copy conf folder from its default folder:

C:\...\solr-8.3.11\server\solr\configsets_default

in here new_core is the name of my new core which I was adding.

so maybe in Ubuntu coping this folder solve your problem.

next solution : after running solr with command prompt or the terminal, to create a core use this command :

solr create -c new_core_name
3

this works normally with me... creating cores as the solr linux user.

sudo su - solr -c "/opt/solr/bin/solr create -c mycol1 -n data_driven_schema_configs"
2

You can solve the problem with the following steps:

  1. Check whether the directories with the right files are exist:

    • /opt/solr/server/gettingstarted/conf/solrconfig.xml
    • /opt/solr/server/gettingstarted/conf/schema.xml
    • /opt/solr/server/gettingstarted/data
  2. then open the Core Admin, "Add new core", enter the right directory/file names and add the core to the system. Actually it will give you an error message that the core already exists. Refresh the admin webpage in the browser and it will automatically load this core now without any error message.

1
  • 1
    and if you don't find the files , you can copy them from configsets/_default/conf , and paste them inside the directory of the core (i'm using solr 8) Apr 29, 2019 at 19:34
2

Looks to me like a possible user permission issue. You seem to be running the commands as root, but some of the work is done by the Solr server. Is it possible that the server process is run with a user that does not have access to the directories mentioned in the error message.

2

Please make sure you have given permission to directory "/opt/solr" with solr user, if not use command

sudo chown -R solr:solr <directory_name>

and then logged in through solr user:

sudo su - solr

go into bin folder and start the solr again if already started stop the solr or kill solr process

./solr start

now finally create new core using below command:

./solr create -c <core_name>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.