Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backing up and cloning the production Solr instance #771

Open
rdhyee opened this issue Dec 9, 2019 · 5 comments
Open

Backing up and cloning the production Solr instance #771

rdhyee opened this issue Dec 9, 2019 · 5 comments

Comments

@rdhyee
Copy link
Collaborator

rdhyee commented Dec 9, 2019

While we are in the process of migrating to new production Solr instances (Build new production Solr instances · Issue #766 · ekansa/open-context-py), it's very helpful to be able to clone the current production Solr instance. In this issue, I will work out a working method for backing up and cloning the production instance.

@rdhyee
Copy link
Collaborator Author

rdhyee commented Dec 9, 2019

What I thought should work but didn't: either creating a snapshot from which to create an image -- or creating a new image directly. I could make an image but when I spun the image up, I had problems with the ssh keys. I think the problem is that the current production solr instance is old and that any new images made from it is not properly configured as a guest. I managed to ssh in using the Google cloud UI but Solr didn't seem to be working properly. So I've abandoned that approach.

@rdhyee
Copy link
Collaborator Author

rdhyee commented Dec 9, 2019

I have an outline of a working approach: build a new Solr instance using Vagrant/ansible and then copy over the old Solr indexes from a recent snapshot of the production Solr instance. It seems that I can use Solr 7 (e.g., 7.7.2) and copy the Solr 6 indices over -- but Solr 8 doesn't seem to work [though I can doublecheck.]. Here's the error:

Caused by: org.apache.lucene.index.IndexFormatTooOldException: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/var/solr/data/open-context/data/index/segments_1ty3"))): 6 (needs to be between 7 and 9). This version of Lucene only supports indexes created with release 6.0 and later.

It might be better to build a Solr 6.4 version (to match the production version) -- given Major Changes in Solr 8 | Apache Solr Reference Guide 8.1:

It is always strongly recommended that you fully reindex your documents after a major version upgrade.

@rdhyee
Copy link
Collaborator Author

rdhyee commented Dec 9, 2019

java - Solr indexing issue after upgrading from 4.7 to 7.1 - Stack Overflow:

You can't upgrade through that many versions in a single upgrade. Solr
(Lucene) only supports the index format from the previous version, so
you might have to do each version by itself.

There's a tool bundled with Solr to help you do this - the
IndexUpgrader
.

@ekansa
Copy link
Owner

ekansa commented Dec 9, 2019 via email

@rdhyee
Copy link
Collaborator Author

rdhyee commented Dec 18, 2019

Here's some notes on how I built the Solr instance I have for backing the staging server.
Note: [ry-20191213a-solr772(https://console.cloud.google.com/compute/instancesDetail/zones/us-central1-f/instances/ry-20191213a-solr772?project=opencontext-py) is the current production solr instance. Here's how I built a new solr instance that I have attached to staging:

I used open-context-py/build_solr.yml at i766_build_solr · rdhyee/open-context-py to build ry-20191216-solr772. The resulting instance:

ry-20191216-solr772.us-central1-f.opencontext-py -- see Compute Engine - OpenContxt Python Dev - Google Cloud Platform

I then

ssh -N -f -L 8987:localhost:8983 ry-20191216-solr772.us-central1-f.opencontext-py

Mount the oc-solr-20191206-disk drive. I use Compute Engine - OpenContxt Python Dev - Google Cloud Platform and hit the "+Attach existing disk", pick oc-solr-20191206-disk from the drop down (and hit done and save?)

I ssh into the new machine (ssh ry-20191216-solr772.us-central1-f.opencontext-py) and then look for the new drive:

raymondyee@ry-20191216-solr772:~$ sudo lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  100G  0 disk
└─sda1   8:1    0  100G  0 part /
sdb      8:16   0  100G  0 disk
└─sdb1   8:17   0  100G  0 part
sudo mkdir -p /mnt/disks/solr_backup
sudo mount -o discard,defaults /dev/sdb1 /mnt/disks/solr_backup

set up configuration files:

sudo bash -c "cp -rp /mnt/disks/solr_backup/opt/oc-solr-6/server/solr/open-context/conf/* /var/solr/data/open-context/conf/"

curl "http://localhost:8983/solr/admin/cores?action=RELOAD&core=open-context&wt=json"
sudo -u solr bash -c "/opt/solr/bin/solr restart"

Now do a restore of the Solr index (Making and Restoring Backups | Apache Solr Reference Guide 7.7)

using HTTPie – command line HTTP client:

http :8987/solr/open-context/replication command==restore location==/mnt/disks/solr_backup/opt/solr_backups name==20191212203254791 wt==json

or curl

curl "localhost:8987/solr/open-context/replication?command=restore&location=%2Fmnt%2Fdisks%2Fsolr_backup%2Fopt%2Fsolr_backups&name=20191212203254791&wt=json"

You can restorestatus:

http :8987/solr/open-context/replication command==restorestatus wt==json

or

curl "localhost:8987/solr/open-context/replication?command=restorestatus&wt=json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants