You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Salmaan Rashid Syed <sa...@mroads.com> on 2020/01/27 08:58:08 UTC

Operation backup caused exception : AccessDeniedException

*Hi Solr Users,*

*I was trying to backup Solr collection using the following command. *

curl --user 'solr-admin:########' "
http://localhost:8983/solr/admin/collections?action=BACKUP&name=panna_backup&collection=PANNA&location=/opt/solr_Backup/solr-data-backup-27-01-2020/
"

*I am getting the following error message. Can anyone please help? *

Operation backup caused
exception:":"java.nio.file.AccessDeniedException:java.nio.file.AccessDeniedException:
/opt/solr_Backup/solr-data-backup-27-01-2020/panna_backup"


"exception":{

    "msg":"/opt/solr_Backup/solr-data-backup-27-01-2020/panna_backup",

    "rspCode":-1},

  "error":{

    "metadata":[

      "error-class","org.apache.solr.common.SolrException",

      "root-error-class","org.apache.solr.common.SolrException"],

    "msg":"/opt/solr_Backup/solr-data-backup-27-01-2020/panna_backup",


*The detail logs are as follows,*


Collection: PANNA operation: backup
failed:java.nio.file.AccessDeniedException:
/opt/solr_Backup/solr-data-backup-27-01-2020/panna_backup

at
java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)

at
java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)

at
java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)

at
java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:385)

at java.base/java.nio.file.Files.createDirectory(Files.java:689)

at
org.apache.solr.core.backup.repository.LocalFileSystemRepository.createDirectory(LocalFileSystemRepository.java:93)

at org.apache.solr.cloud.api.collections.BackupCmd.call(BackupCmd.java:90)

at
org.apache.solr.cloud.api.collections.OverseerCollectionMessageHandler.processMessage(OverseerCollectionMessageHandler.java:259)

at
org.apache.solr.cloud.OverseerTaskProcessor$Runner.run(OverseerTaskProcessor.java:478)

at
org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:209)

at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:834)



*Thanks and Regards,*

*Salmaan*

Re: Operation backup caused exception : AccessDeniedException

Posted by Shawn Heisey <ap...@elyograg.org>.
On 1/29/2020 3:26 AM, Salmaan Rashid Syed wrote:
> I was trying to execute the backup command using curl command on my work
> computer to see why EC2 instance was giving the previous error. On my
> current computer, I have root privileges. But when I execute the command on
> my work computer, I have a different problem. It states that the
> path/folder doesn't exist as follows.

It makes no difference what user makes the HTTP request.  OS user 
information is not transmitted with the request.

> I was reading the documentation for Backup and restore of solr. The
> location should be a shared drive for the backup. Can I not store it on my
> hard drive?.

If you have only one Solr server, then you can use its hard drive.  But 
if you have more than one Solr instance running on different machines, 
they all must access the same storage at the same mount point, so that 
when multiple servers execute the backup, the data is all sent to the 
same location.

> But, when I tried downloading the backup to my drive on computer, it worked
> fine previously. But, now it refuses to download the solr backup file to my
> hard drive.

The backup location must exist on the Solr server(s).  The data will NOT 
be sent to a location on a workstation that makes the HTTP request.

> The only change that the Solr underwent from the previous time is that I
> have enabled authentication on it.
> 
> Is authentication causing all these problems?.

I do not know.  I would not expect it to.  I have never used Solr's 
authentication mechanisms.

Thanks,
Shawn

Re: Operation backup caused exception : AccessDeniedException

Posted by Salmaan Rashid Syed <sa...@mroads.com>.
Hi Shawn,

I was trying to execute the backup command using curl command on my work
computer to see why EC2 instance was giving the previous error. On my
current computer, I have root privileges. But when I execute the command on
my work computer, I have a different problem. It states that the
path/folder doesn't exist as follows.

sudo curl --user "solr-admin:#####" "
http://solr.mroads.com:8983/solr/admin/collections?action=BACKUP&name=panna_backup&collection=PANNA&location=/Users/salmaan/
"

{

  "responseHeader":{

    "status":500,

    "QTime":0},

  "error":{

    "metadata":[

      "error-class","org.apache.solr.common.SolrException",

      "root-error-class","org.apache.solr.common.SolrException"],

    "msg":"specified location file:///Users/salmaan does not exist.",

org.apache.solr.common.SolrException: specified location
file:///Users/salmaan does not exist.
	at org.apache.solr.handler.admin.CollectionsHandler$CollectionOperation.lambda$static$30(CollectionsHandler.java:980)
	at org.apache.solr.handler.admin.CollectionsHandler$CollectionOperation.execute(CollectionsHandler.java:1177)
	at org.apache.solr.handler.admin.CollectionsHandler.invokeAction(CollectionsHandler.java:258)
	at org.apache.solr.handler.admin.CollectionsHandler.handleRequestBody(CollectionsHandler.java:246)
	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:199)
	at org.apache.solr.servlet.HttpSolrCall.handleAdmin(HttpSolrCall.java:734)
	at org.apache.solr.servlet.HttpSolrCall.handleAdminRequest(HttpSolrCall.java:715)
	at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:496)
	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:377)
	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:323)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:531)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
	at java.base/java.lang.Thread.run(Thread.java:834)


I was reading the documentation for Backup and restore of solr. The
location should be a shared drive for the backup. Can I not store it on my
hard drive?.

But, when I tried downloading the backup to my drive on computer, it worked
fine previously. But, now it refuses to download the solr backup file to my
hard drive.

The only change that the Solr underwent from the previous time is that I
have enabled authentication on it.

Is authentication causing all these problems?.

Thanks for your help.

Regards,
Salmaan



On Tue, Jan 28, 2020 at 8:15 AM Shawn Heisey <ap...@elyograg.org> wrote:

> On 1/27/2020 6:57 PM, Salmaan Rashid Syed wrote:
> > I have Solr 7.6 and it is installed in an AWS ec2 (Ubuntu machine)
> > instance. I am new to AWS. Devops team has configured it for me.
>
> When I check out the source for Solr 7.6, it intersects perfectly with
> the line numbers in the stacktrace that you provided.
>
> > One thing I constantly notice while executing commands in ec2 instance is
> > that, it keeps denying command execution until I specifically insert
> "sudo"
> > at the beginning.
> >
> > For example mkdir command also needs sudo at the beginning of the command
> > etc.
>
> If the parent directory is owned by root and Solr is running as a
> regular user, then Solr will most likely not have permission to create
> the desired directory.  In that situation, the owner will need to be
> changed so that the user running Solr does have permission.
>
> If Solr has been installed as a service by the service installer
> included in the download, then it is extremely likely that it will not
> be running as root, and the default username that the installer uses is
> solr.
>
> Thanks,
> Shawn
>

Re: Operation backup caused exception : AccessDeniedException

Posted by Shawn Heisey <ap...@elyograg.org>.
On 1/27/2020 6:57 PM, Salmaan Rashid Syed wrote:
> I have Solr 7.6 and it is installed in an AWS ec2 (Ubuntu machine)
> instance. I am new to AWS. Devops team has configured it for me.

When I check out the source for Solr 7.6, it intersects perfectly with 
the line numbers in the stacktrace that you provided.

> One thing I constantly notice while executing commands in ec2 instance is
> that, it keeps denying command execution until I specifically insert "sudo"
> at the beginning.
> 
> For example mkdir command also needs sudo at the beginning of the command
> etc.

If the parent directory is owned by root and Solr is running as a 
regular user, then Solr will most likely not have permission to create 
the desired directory.  In that situation, the owner will need to be 
changed so that the user running Solr does have permission.

If Solr has been installed as a service by the service installer 
included in the download, then it is extremely likely that it will not 
be running as root, and the default username that the installer uses is 
solr.

Thanks,
Shawn

Re: Operation backup caused exception : AccessDeniedException

Posted by Salmaan Rashid Syed <sa...@mroads.com>.
Hi Shawn,

Thanks for the reply. Apologies for the missing information.

I have Solr 7.6 and it is installed in an AWS ec2 (Ubuntu machine)
instance. I am new to AWS. Devops team has configured it for me.

One thing I constantly notice while executing commands in ec2 instance is
that, it keeps denying command execution until I specifically insert "sudo"
at the beginning.

For example mkdir command also needs sudo at the beginning of the command
etc.

Does this also cause AccessDeniedException or am I missing something in my
curl command?

Do I need to ask devops to remove the user restrictions in AWS, though I am
not sure if there are any?

Thanks in advance.

Regards,
Salmaan





On Mon 27 Jan, 2020, 10:47 PM Shawn Heisey, <ap...@elyograg.org> wrote:

> On 1/27/2020 1:58 AM, Salmaan Rashid Syed wrote:
> > Collection: PANNA operation: backup
> > failed:java.nio.file.AccessDeniedException:
> > /opt/solr_Backup/solr-data-backup-27-01-2020/panna_backup
>
> <snip>
>
> > at java.base/java.nio.file.Files.createDirectory(Files.java:689)
>
> While trying to create a directory, Java found that it did not have
> permission to do so.  Looking at the code involved in the stacktrace,
> the problem is either that the user running Solr does not have
> permission to create a directory in
> /opt/solr_Backup/solr-data-backup-27-01-2020 or that
> /opt/solr_Backup/solr-data-backup-27-01-2020 does not exist.
>
> You haven't told us which precise version of Solr you have, so although
> I am fairly confident that I've got the correct diagnosis, I can't be
> 100 percent sure.
>
> Thanks,
> Shawn
>

Re: Operation backup caused exception : AccessDeniedException

Posted by Shawn Heisey <ap...@elyograg.org>.
On 1/27/2020 1:58 AM, Salmaan Rashid Syed wrote:
> Collection: PANNA operation: backup
> failed:java.nio.file.AccessDeniedException:
> /opt/solr_Backup/solr-data-backup-27-01-2020/panna_backup

<snip>

> at java.base/java.nio.file.Files.createDirectory(Files.java:689)

While trying to create a directory, Java found that it did not have 
permission to do so.  Looking at the code involved in the stacktrace, 
the problem is either that the user running Solr does not have 
permission to create a directory in 
/opt/solr_Backup/solr-data-backup-27-01-2020 or that 
/opt/solr_Backup/solr-data-backup-27-01-2020 does not exist.

You haven't told us which precise version of Solr you have, so although 
I am fairly confident that I've got the correct diagnosis, I can't be 
100 percent sure.

Thanks,
Shawn