Monday, May 23, 2016

Important Apache Solr 6+ Commands for Windows

Sometimes what we really need is a quick reference to common commands we use on a somewhat-daily basis.
We are a Windows shop and sometimes Windows doesn't receive the same love as the *nix world in Solr.

Note that most of these commands are to be executed from the root directory of your Apache Solr installation (or solr-src\solr directory if you compiled from source).  This article will be updated as we get more involved with Apache Solr.  Not all of these commands are Windows-specific, but many are.

ZooKeeper

Solr Cloud

One thing that's unique about Solr Cloud is that everything is in a "cloud," so instead of editing a file on the filesystem, you are expected to use the Config API or download and upload the config file to be distributed throughout the cloud.  That process took a while to discover.  The procedure is to download the working version of the solr cloud solrconfig.xml, put it in source control (optional, but recommended), make your changes, then push those changes back to the cloud by uploading the file to ZooKeeper and check back into source control.


Download the solrconfig.xml for the gettingstarted collection
server\scripts\cloud-scripts\zkcli.bat -cmd getfile /configs/gettingstarted/solrconfig.xml solrconfiglocal.xml -zkhost localhost:9983


Upload the solrconfig.xml for the gettingstarted collection
server\scripts\cloud-scripts\zkcli.bat -cmd putfile /configs/gettingstarted/solrconfig.xml solrconfiglocal.xml -zkhost localhost:9983

Apache Solr

Management

Start
Start Solr for the first time to create a cloud collection (called gettingstarted [default name]).  Also used to start it after the first time (which created it).
(from solr dir)
bin\solr.cmd start -e cloud -noprompt

Stop
bin\solr.cmd stop -all

Index documents (from the file system)
java -Dc=gettingstarted -Dauto=yes -Drecursive=yes -jar example\exampledocs\post.jar example\exampledocs

Search

Use a different query parser
Let's say you want to use the surround query parser, which comes with Solr.
q={!surround}test

2 comments:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in APACHE SOLR
    , kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on APACHE SOLR . We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com



    ReplyDelete
  2. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor led live training in Apache Solr, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Apache Solr. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Nitesh Kumar
    MaxMunus
    E-mail: nitesh@maxmunus.com
    Skype id: nitesh_maxmunus
    Ph:(+91) 8553912023
    http://www.maxmunus.com/


    ReplyDelete