Search code examples
solrdiskspace

How to optimize Solr index when not enough disk space?


I need to optimize a solr index that currently has about 1,000 files on disk that take up about 400GB. I have 200GB free on my disk, and I have another disk with about 1TB of free space.

Is there any way to either:

  • Optimize using less than 200GB, or
  • Optimize using the secondary disk?

My impression is that Solr rebuilds the index from scratch and then swaps it in, so it seems like this ought to somehow be possible. I've got a terabyte sitting there. Can I use it?


Solution

  • Copy the data to the 1TB drive and change solrconfig.xml to point to the new directory.

    https://wiki.apache.org/solr/SolrConfigXml#dataDir_parameter

    <dataDir>/var/data/solr</dataDir>
    

    Make sure you stop your server before you copy the data. Optimize the index and expunge the deleted documents.