What is the best practice to backup a lucene index without taking the index offline (hot backup)?
See Question&Answers more detail:osWhat is the best practice to backup a lucene index without taking the index offline (hot backup)?
See Question&Answers more detail:osYou don't have to stop your IndexWriter in order to take a backup of the index.
Just use the SnapshotDeletionPolicy, which lets you "protect" a given commit point (and all files it includes) from being deleted. Then, copy the files in that commit point to your backup, and finally release the commit.
It's fine if the backup takes a while to run -- as long as you don't release the commit point with SnapshotDeletionPolicy, the IndexWriter will not delete the files (even if, eg, they have since been merged together).
This gives you a consistent backup which is a point-in-time image of the index without blocking ongoing indexing.
I wrote about this in Lucene in Action (2nd edition), and there's paper excerpted from the book available (free) from http://www.manning.com/hatcher3, "Hot Backups with Lucene", that describes this in more detail.