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 rhys J <rh...@gmail.com> on 2019/12/11 18:06:00 UTC
backing up and restoring
I made backups with the following command:
sudo -u solr curl '
http://localhost:8983/solr/debt/replication?command=backup&location=/tmp/solr
<http://localhost:8983/solr/gettingstarted/replication?command=backup&location=/tmp/solr>
backups/debt/'
I double checked that I had made the backup, and I had a backup.
To test the restore function, I deleted documents with the following
command:
sudo -u solr curl http://localhost:8983/solr/debt/update -H "Content-type:
text/xml" --data-binary '<delete><query>*:*</query></delete>
I stopped and started the service to verify that there are 0 documents in
the debt core.
Then I ran the following command:
sudo -u solr curl
'http://localhost:8983/solr/debt/replication?command=restore&name=/tmp/solrbackups/debt/snapshot.20191211175715254'
response:
"responseHeader":{
"status":0,
"QTime":4},
"status":"OK"}
Then I went to the web API to check the amount of documents I had on the
core. It still says 0.
I stopped and started the service to just be sure that that wasn't the
problem, but it still says there are 0 documents.
Am I missing a step in how i restore a backup?
Thanks,
Rhys
Re: backing up and restoring
Posted by rhys J <rh...@gmail.com>.
On Thu, Dec 12, 2019 at 3:49 AM sudhir kumar <go...@gmail.com>
wrote:
> once you backup index with some location, you have to specify the same
> location to restore.
>
> ie in your case /tmp/solr is the location indexed was backed up , use same
> location for restore.
>
> you did not provide name so latest snapshot will be restored.
>
> curl '
>
> http://localhost:8983/solr/debt/replication?command=backup&location=/tmp/solr
> '
>
> snapshot is created at /tmp/solr/snapshot.2019xxxxxxxxxx
>
> execute below command, latest snapshot will be restored
> curl '
>
> http://localhost:8983/solr/debt/replication?command=restore&location=/tmp/solr
> <
> http://localhost:8983/solr/debt/replication?command=backup&location=/tmp/solr
> >
> '
>
>
I figured this out, but even when I specify location, and even name, I get
an OK from the status, but the index remains empty?
Commands used:
sudo -u solr curl '
http://localhost:8983/solr/debt/replication?command=backup
<http://localhost:8983/solr/gettingstarted/replication?command=backup&location=/tmp/solr>
&location=/tmp/solrbackups/debt/'
sudo -u solr curl
'http://localhost:8983/solr/debt/replication?command=restore&location=/tmp/solrbackups/debt/'
Thanks,
Rhys
Re: backing up and restoring
Posted by rhys J <rh...@gmail.com>.
On Mon, Dec 16, 2019 at 1:42 AM Paras Lehana <pa...@indiamart.com>
wrote:
> Looks like a write lock. Did reloading the core fix that? I guess it would
> have been fixed by now. I guess you had run the delete query few moments
> after restoring, no?
>
>
Restoring setting the name parameter only worked the once.
This is my workaround:
run backup command
Delete documents.
Stop solr
Start solr
delete the segment and write.lock files by name.
Copy over the index files from the snapshot to the data/index folder
Start solr
Verify presence of documents via search for *:*
I know it's not pretty, but I have found it works every time.
Thanks,
Rhys
Re: backing up and restoring
Posted by Paras Lehana <pa...@indiamart.com>.
Looks like a write lock. Did reloading the core fix that? I guess it would
have been fixed by now. I guess you had run the delete query few moments
after restoring, no?
On Thu, 12 Dec 2019 at 21:55, rhys J <rh...@gmail.com> wrote:
> I was able to successfully restore a backup by specifying name and location
> in the restore command.
>
> But now when i try to run:
>
> sudo -u solr curl http://localhost:8983/solr/debt/update -H "Content-type:
> text/xml" --data-binary '<delete><query>*:*</query></delete>'
>
> I get the following error:
>
> <str name="msg">no segments* file found in
> LockValidatingDirectoryWrapper(NRTCachingDirectory(MMapDirectory@
> /var/solr/data/debt/data/index
> lockFactory=org.apache.lucene.store.NativeFSLockFactory@4746f577;
> maxCacheMB=48.0 maxMergeSizeMB=4.0)): files: [write.lock]</str>
> <str name="trace">org.apache.lucene.index.IndexNotFoundException: no
> segments* file found in
> LockValidatingDirectoryWrapper(NRTCachingDirectory(MMapDirectory@
> /var/solr/data/debt/data/index
> lockFactory=org.apache.lucene.store.NativeFSLockFactory@4746f577;
> maxCacheMB=48.0 maxMergeSizeMB=4.0)): files: [write.lock]
>
> I am just copying the top portion of the error, as it is very long.
>
> What did I do wrong?
>
> Thanks,
>
> Rhys
>
--
--
Regards,
*Paras Lehana* [65871]
Development Engineer, Auto-Suggest,
IndiaMART Intermesh Ltd.
8th Floor, Tower A, Advant-Navis Business Park, Sector 142,
Noida, UP, IN - 201303
Mob.: +91-9560911996
Work: 01203916600 | Extn: *8173*
--
*
*
<https://www.facebook.com/IndiaMART/videos/578196442936091/>
Re: backing up and restoring
Posted by rhys J <rh...@gmail.com>.
I was able to successfully restore a backup by specifying name and location
in the restore command.
But now when i try to run:
sudo -u solr curl http://localhost:8983/solr/debt/update -H "Content-type:
text/xml" --data-binary '<delete><query>*:*</query></delete>'
I get the following error:
<str name="msg">no segments* file found in
LockValidatingDirectoryWrapper(NRTCachingDirectory(MMapDirectory@/var/solr/data/debt/data/index
lockFactory=org.apache.lucene.store.NativeFSLockFactory@4746f577;
maxCacheMB=48.0 maxMergeSizeMB=4.0)): files: [write.lock]</str>
<str name="trace">org.apache.lucene.index.IndexNotFoundException: no
segments* file found in
LockValidatingDirectoryWrapper(NRTCachingDirectory(MMapDirectory@/var/solr/data/debt/data/index
lockFactory=org.apache.lucene.store.NativeFSLockFactory@4746f577;
maxCacheMB=48.0 maxMergeSizeMB=4.0)): files: [write.lock]
I am just copying the top portion of the error, as it is very long.
What did I do wrong?
Thanks,
Rhys
Re: backing up and restoring
Posted by rhys J <rh...@gmail.com>.
This page seems to indicate that I should copy the files from the backup
directory back into the index?
Is this accurate?
https://codice.atlassian.net/wiki/spaces/DDF22/pages/2785407/Solr+Standalone+Server+Backup
Thanks,
Rhys
Re: backing up and restoring
Posted by sudhir kumar <go...@gmail.com>.
Hi Rhyhs,
once you backup index with some location, you have to specify the same
location to restore.
ie in your case /tmp/solr is the location indexed was backed up , use same
location for restore.
you did not provide name so latest snapshot will be restored.
curl '
http://localhost:8983/solr/debt/replication?command=backup&location=/tmp/solr
'
snapshot is created at /tmp/solr/snapshot.2019xxxxxxxxxx
execute below command, latest snapshot will be restored
curl '
http://localhost:8983/solr/debt/replication?command=restore&location=/tmp/solr
<http://localhost:8983/solr/debt/replication?command=backup&location=/tmp/solr>
'
below command can be used for details:
curl 'http://localhost:8983/solr/debt/replication?command=details
<http://localhost:8983/solr/debt/replication?command=backup&location=/tmp/solr>
'
for details please refer:
https://lucene.apache.org/solr/guide/6_6/making-and-restoring-backups.html
Thanks,
Sudhir .
On Wed, Dec 11, 2019 at 11:36 PM rhys J <rh...@gmail.com> wrote:
> I made backups with the following command:
>
> sudo -u solr curl '
>
> http://localhost:8983/solr/debt/replication?command=backup&location=/tmp/solr
> <
> http://localhost:8983/solr/gettingstarted/replication?command=backup&location=/tmp/solr
> >
> backups/debt/'
>
> I double checked that I had made the backup, and I had a backup.
>
> To test the restore function, I deleted documents with the following
> command:
>
> sudo -u solr curl http://localhost:8983/solr/debt/update -H "Content-type:
> text/xml" --data-binary '<delete><query>*:*</query></delete>
>
> I stopped and started the service to verify that there are 0 documents in
> the debt core.
>
> Then I ran the following command:
>
> sudo -u solr curl
> '
> http://localhost:8983/solr/debt/replication?command=restore&name=/tmp/solrbackups/debt/snapshot.20191211175715254
> '
>
> response:
>
> "responseHeader":{
> "status":0,
> "QTime":4},
> "status":"OK"}
>
> Then I went to the web API to check the amount of documents I had on the
> core. It still says 0.
>
> I stopped and started the service to just be sure that that wasn't the
> problem, but it still says there are 0 documents.
>
> Am I missing a step in how i restore a backup?
>
> Thanks,
>
> Rhys
>