RE: Need to update SOLR_HOME in the solr service script and getting errors

2020-09-17 Thread Victor Kretzer
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  
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 +, 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


Re: Need to update SOLR_HOME in the solr service script and getting errors

2020-09-17 Thread Mark H. Wood
On Wed, Sep 16, 2020 at 02:59:32PM +, 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.SolrException: 
> /opt/solr-6.6.6/cloud/test2/mycollection_shard1_replica1/data/index/write.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


signature.asc
Description: PGP signature


Need to update SOLR_HOME in the solr service script and getting errors

2020-09-16 Thread Victor Kretzer
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" 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.SolrException: 
/opt/solr-6.6.6/cloud/test2/mycollection_shard1_replica1/data/index/write.lock
Please check your logs for more information

[cid:image001.png@01D68C18.8565BFB0]

I'm including what I believe to be the pertinent information from the logs 
below:
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?

java.util.concurrent.ExecutionException: org.apache.solr.common.SolrException: 
Unable to create core [mycollection_shard1_replica1]
  at java.util.concurrent.FutureTask.report(FutureTask.java:122)
  at java.util.concurrent.FutureTask.get(FutureTask.java:192)
  at 
org.apache.solr.core.CoreContainer.lambda$load$6(CoreContainer.java:594)
  at 
com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176)
  at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at 
org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
  at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.solr.common.SolrException: Unable to create core 
[mycollection_shard1_replica1]
  at 
org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:966)
  at 
org.apache.solr.core.CoreContainer.lambda$load$5(CoreContainer.java:565)
  at 
com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197)
  ... 5 more
Caused by: org.apache.solr.common.SolrException: 
/opt/solr-6.6.6/cloud/test2/mycollection_shard1_replica1/data/index/write.lock
  at org.apache.solr.core.SolrCore.(SolrCore.java:977)
  at org.apache.solr.core.SolrCore.(SolrCore.java:830)
  at 
org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:950)
  ... 7 more
Caused by: java.nio.file.AccessDeniedException: 
/opt/solr-6.6.6/cloud/test2/mycollection_shard1_replica1/data/index/write.lock
  at 
sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
  at 
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
  at 
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
  at 
sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177)
  at java.nio.channels.FileChannel.open(FileChannel.java:287)
  at java.nio.channels.FileChannel.open(FileChannel.java:335)
  at 
org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:113)
  at 
org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41)
  at 
org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45)
  at 
org.apache.lucene.store.FilterDirectory.obtainLock(FilterDirectory.java:104)
  at 
org.apache.lucene.index.IndexWriter.isLocked(IndexWriter.java:4776)
  at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:709)
  at org.apache.solr.core.SolrCore.(SolrCore.java:923)


Thanks for the help,
Victor