Requirements:
- old collection, ex. article-v1 must be still available for querying
- new collection, ex. article-v2 will be created with solrctl and will be reindexed
How to do it:
- Create the new collection (article-v2) using solrctl command-line tool:
Upload the configs directory from local filesystem to the ZooKeeper:solrctl instancedir --create article-v2 /data/articleCreate the new collection with 16 shards and two replicas for each shardsolrctl collection --create article-v2 -s 16 -r 2 - test the new collection, do full reindex etc.
- drop the alias targeted to the old collection through Collections API (https://cwiki.apache.org/confluence/display/solr/Collections+API):
http://solr-node1:8983/solr/admin/collections?action=DELETEALIAS&name=article - create the new alias:
http://solr-node1:8983/solr/admin/collections?action=CREATEALIAS&name=article&collections=article-v2 - now, you can query the new collection via the alias, for example:
http://solr-node1:8983/solr/article/select?q=author:orwell&rows=10&wt=json&indent=true - finally, you should remove the old collection completely:
solrctl collection —delete article-v1
solrctl instancedir —delete article-v2
Listing all aliases:
http://solr-node1:8983/solr/zookeeper?detail=true&path=/aliases.json
Tested on Solr version: 4.4.0-cdh5.3.1