How to create a copy of existing Solr index

If you have an already existing Solr index and you want to try new settings, it is best to work and test on a copy Solr’s index first.
Here are the simple steps to make a copy of your Solr’s index:
Suppose we have already an index named cast and the copy will be named castSpell.

  1. Make new directory under solr (e.g. castSpell).
  2. Copy the entire directories conf and lib from cast to castSpell.
  3. Make new directory called data under the new directory castspell.
  4. Add to solr.xml your new index name:   <core instanceDir=”castSpell” name=”castSpell” />
  5. Restart Jetty (e.g. sudo /etc/init.d/jetty restart)
  6. Go to http://localhost:8983/solr/castSpell/admin/dataimport.jsp?handler=/dataimport
    • click on Reload-config
    • click on Full-import
    • continue to next step only after the status became “idle” (by clicking on Status).
  7. Test your new index by: http://localhost:8983/solr/castSpell/select/?q=*:*&start=0&rows=10&indent=on
6 Comments
  1. dinesh says:

    Hi Hazan, that is really helpful post.
    I have one question like if I add new schema/index to the solr do I need to restart solr for the changes to take effect. If yes, is there any way to add index/schema to solr without needing to restart it.

  2. Yuval says:

    Hi Ilan. Nice post.
    Two comments:
    a. item 4 looks suspicious (shouldn’t it be castSpell rather than quoteSpell?)
    b. LukeRequestHandler can be useful for this:
    http://wiki.apache.org/solr/LukeRequestHandler
    Basically, it shows you the existing index structure, number of documents, fields etc.
    Therefore, you can use it to compare the source index and the copy.
    Cheers,
    Yuval

Leave a Reply

*