You need to move from one solr instance to another and can't be bothered with mismatching versions or whatever? These two scripts will help you :)
First you need to create a new core in the target instance. You may want to use the schema/configset from the originating instance though, as the default schema might not be ideal.
Im my scenario I moved from Solr 5.5.5 to Solr 7.4.
Therefore I had to (at least) update the solrconfig.xml
, where the lucene version is specified.
The exact version you need can be found in the default configset ([solr_root]/server/solr/configsets/...
)
The first script downloads and entire core into one file (one json document per line).
python download.py 172.0.0.1 8983 my_core my_core.json
The second one uploads it to a server.
python uploadSolr.py 172.0.0.1 8983 my_core my_core.json
IMPORTANT
The download script is extremely stupid. Once it's done, it will continue requesting the server. Fortunately tqdm will give you a rough estimate for how long it may take to finish, so you know how long your coffe break can be. There will be no harm if it runs for a while (except heating up your server). Once the progress bar is full, kill the script with Ctrl+C.
FYI: Downloading 2.5G (380k docs) took 5 minutes, uploading them again took just over an hour.
Requirements to install:
- pysolr
- requests
- tqdm
You could remove tqdm from the code. It's for a nice progress bar. requests could also be removed, but I'm to lazy to update the download scrip to also use pysolr (or vice versa).
Thanks!