Hi Mark. 

Thanks for taking the time to explain it so clearly. It makes perfect sense to 
me now and using chown solved the problem. Thanks again and have a great day.

Victor


-----Original Message-----
From: Mark H. Wood <mw...@iupui.edu> 
Sent: Thursday, September 17, 2020 9:59 AM
To: solr-user@lucene.apache.org
Subject: Re: Need to update SOLR_HOME in the solr service script and getting 
errors

On Wed, Sep 16, 2020 at 02:59:32PM +0000, Victor Kretzer wrote:
> My setup is two solr nodes running on separate Azure Ubuntu 18.04 LTS vms 
> using an external zookeeper assembly.
> I installed Solr 6.6.6 using the install file and then followed the steps for 
> enabling ssl. I am able to start solr, add collections and the like using 
> bin/solr script.
> 
> Example:
> /opt/solr$ sudo bin/solr start -cloud -s cloud/test2 -force
> 
> However, if I restart the machine or attempt to start solr using the 
> installed service, it naturally goes back to the default SOLR_HOME in the 
> /etc/default/solr.in.sh script: "/var/solr/data"
> 
> I've tried updating SOLR_HOME to "/opt/solr/cloud/test2"

That is what I would do.

> but then when I start the service I see the following error on the Admin 
> Dashboard:
> SolrCore Initialization Failures
> mycollection_shard1_replica1: 
> org.apache.solr.common.SolrException:org.apache.solr.common.SolrExcept
> ion: 
> /opt/solr-6.6.6/cloud/test2/mycollection_shard1_replica1/data/index/wr
> ite.lock Please check your logs for more information
> 
> I'm including what I believe to be the pertinent information from the logs 
> below:

You did well.

> I suspect this is a permission issue because the solr user created by the 
> install script isn't allowed access to  /opt/solr but I'm new to Linux and 
> haven't completely wrapped my head around the way permissions work with it. 
> Am I correct in guessing the cause of the error and, if so, how do I correct 
> this so that the service can be used to run my instances?

Yes, the stack trace actually tells you explicitly that the problem is 
permissions on that file.  Follow the chain of "Caused by:" and you'll see:

  Caused by: java.nio.file.AccessDeniedException: 
/opt/solr-6.6.6/cloud/test2/mycollection_shard1_replica1/data/index/write.lock

Since, in the past, you have started Solr using 'sudo', this probably means 
that write.lock is owned by 'root'.  Solr creates this file with permissions 
that allow only the owner to write it.  If the service script runs Solr as any 
other user (and it should!) then Solr won't be able to open this file for 
writing, and because of this it won't complete the loading of that core.

You should find out what user account is used by the service script, and 
'chown' Solr's entire working directories tree to be owned by that user.  Then, 
refrain from ever running Solr as 'root' or the problem may recur.  Use the 
normal service start/stop mechanism for controlling your Solr instances.

--
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

Reply via email to