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.
- Make new directory under solr (e.g. castSpell).
- Copy the entire directories conf and lib from cast to castSpell.
- Make new directory called data under the new directory castspell.
- Add to solr.xml your new index name: <core instanceDir=”castSpell” name=”castSpell” />
- Restart Jetty (e.g. sudo /etc/init.d/jetty restart)
- 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).
- Test your new index by: http://localhost:8983/solr/castSpell/select/?q=*:*&start=0&rows=10&indent=on
6 Comments
Leave a Reply
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.
As far as I know you must restart Solr server for the changes to take effect.
However, I found something interesting. Try Reload Solr without restart
If it helps, please share.
Thanks,
Ilan.
You can create a new core like this (copied from the Solr wiki CoreAdmin page): http://localhost:8983/solr/admin/cores?action=CREATE&name=coreX&instanceDir=path_to_instance_directory&config=config_file_name.xml&schema=schem_file_name.xml&dataDir=data
This is for creating “new” cores AND for loading cores that are not in the solr.xml file. If data already exists in the instance directory, it will load the data intact. We do not persist any core names in our solr.xml. We load them like this after solr starts up.
You can use the RELOAD action to reload a core if you have made compatible schema changes or if you want to do something like blow the current Searcher to test how your cache behaves after Solr 3.x replication. There are other uses as well.
Hi Jim,
Thanks for your comment and for sharing.
Ilan.
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
I have fixed the post
Many thanks Yuval!