Apache SOLR – Understanding the built in scripts

Apache SOLR has several very handy built in scripts to help you manage Masters and Slaves.  The understanding of what these scripts do might be a little fuzzy however… so here are they are in a straight forward fashion.

Snappuller-enable

  • Built in script provided by solr ({install_dir}/solr/bin/snappuller-enable)
  • This script allows you to turn on the Snappuller functionality. I.E. you need to enable the snappuller before using it.

Snapshooter

  • Built in script provided by solr ({install_dir}/solr/bin/snapshooter)
  • Run this script on a master to create a snapshot of it’s data
  • The snapshot is pulled by clients and installed to perform backups / replication

Snappuller

  • Built in script provided by solr ({install_dir}/solr/bin/snappuller)
  • Run this script on a slave to connect to a master and bring over the most recent snapshots of data
  • This script updates a data file on the master letting the master know which snapshots it has received
  • This script is commonly setup on slaves to run say every 5 mins along with the snapinstaller

Snapinstaller

  • Built in script provided by solr ({install_dir}/solr/bin/snapinstaller)
  • Run this script on a slave to install any pending snapshots that have been brought over from a master server
  • This script should be run immediately after running the “snappuller” script – until done – updated data will not be on the slaves. (well they will be there – but not available for client reads)
  • This script is commonly setup to run after the “snappuller” script on slaves

Snapcleaner

  • Built in script provided by solr (/opt/solr/solr/bin/snapcleaner)
  • Run this script on both masters and servers to get rid of old snapshots
  • Pass in arguments to the script to either dictate how many snapshots to keep -N or how many days worth of snapshots to keep -D. The example below will clean out all but the most recent twenty snapshots.

    0 0 * * * {install_dir}/solr/bin/snapcleaner -N 20

  • NOTE: If snapshots are made every 5 minutes, then a full days worth would be 480 snapshots.
Posted in , and tagged .

Leave a Reply

Your email address will not be published. Required fields are marked *