Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

solr installation, cannot start examples

First: I want to learn solr. So I want to execute the quickstart tutorial from http://lucene.apache.org/solr/quickstart.html

On ubuntu 14.04 64 bit I installed solr the following way:

In /opt per wget I took the latest version 6.3.0. This was made as root.

Then I extracted the service installation file by

tar xzf solr-6.3.0.tgz solr-6.3.0/bin/install_solr_service.sh --strip-components=2

Also by root!

I let it run by

sudo ./install_solr_service.sh solr-6.3.0.tgz

that led to user/group solr, started solr as a service, made a symlink from /opt/solr to /opt/solr-6.3.0, made solr.home to /var/solr with user solr as owner etc.

Solr is started as expected so http://localhost:8983/solr/#/ shows me the dash in the browser.

I stop with the usual command

service solr stop 

the service to start the examples.

And here the problem:

When I start as root:

root@duke:/opt/solr# bin/solr start -e cloud -noprompt

here the results:

"Welcome to the SolrCloud example!

Starting up 2 Solr nodes for your example SolrCloud cluster.

Solr home directory /opt/solr/example/cloud/node1/solr already exists. /opt/solr/example/cloud/node2 already exists.

Starting up Solr on port 8983 using command: /opt/solr/bin/solr start -cloud -p 8983 -s "/opt/solr/example/cloud/node1/solr"

WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting. Please consult the Reference Guide. To override this check, start with argument '-force'

ERROR: Process exited with an error: 1 (Exit value: 1)"

So root is not the correct owner, which I understand because there is a new user solr created.

Then I change to solr as user to start the examples:

solr@duke:/opt/solr$ bin/solr start -e cloud -noprompt

"Welcome to the SolrCloud example!

Starting up 2 Solr nodes for your example SolrCloud cluster.

Creating Solr home directory /opt/solr/example/cloud/node1/solr

ERROR: Destination '/opt/solr/example/cloud/node1/solr' directory cannot be created"

So the first test as root give me no permission because of solr and the second one as user solr give me no permission to create directories/files.

What is to do???

like image 782
maen Avatar asked Sep 17 '25 03:09

maen


1 Answers

When you're running as the Solr user, you'll have to give the solr user access to the directory where you're trying to write your configuration. If this is /opt/solr, you can change the owner of the directory and all contained files recursively by issuing a chown command:

chown -R solr.solr /opt/solr

This assumes that there's also a group named solr on your system. If you don't have a solr group, either use another, suitable group, or leave the last .solr out of the command.

like image 118
MatsLindh Avatar answered Sep 19 '25 18:09

MatsLindh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!