Saturday, June 23, 2012

SOLR - Upgrade to Jetty 8


After working with Solr for so many years, right from solr version 1.2 I realised it usually started with downloading the latest source distribution and working from the example dir wihich had a solr instance packaged in jetty 6.x container. All these years Solr versions kept changing from 1.x to 3.x series but jetty version stayed at 6.x. recently I discovered that eclipse foundation has released jetty 8 stable version after years of hard work. While the new Solr version is going to upgrade current 3.x release is going to stay on jetty 6.x. So I decided to take the plunge and do the upgrade myself.

I used the latest Solr 3.6.0 version which is the latest stable release of solr as of now and the jetty 8.1.4.v20120524 version, also the latest stable release of jetty 8. The key change is the way in which jsp is supported by jetty 8, we need to specify the jsp in options. Jetty 8 uses jsp 2.2 compared to 2.1 in earlier version and servlet 3.0 compared to 2.5 in jetty 6.


To start the action, you can pull out the ready to run solr server directly from github at:

https://github.com/umars/jetty-solr

To start the server you just need to first clone the repo and then start the server as:

   git clone https://github.com/umars/jetty-solr

For all purpose i will call the newly checked out dir as JETTY_DIR

   cd $JETTY_DIR
   java -jar start.jar

When you see a message like "Started SocketConnector@0.0.0.0:8983" , your server should be ready now to be used

To demonstrate the use , the exampledocs dir contains some sample documents , same as provided in the solr distribution. From another console run the following commands:

   cd $JETTY_DIR/exampledocs
   ./post.sh *.xml


You should see some activity on the console where we started the server, as the data in the files get posted to the index. When you see a message like "INFO: {commit=}" , the solr server has data ready to be served.

Now fire up a browser and go to  "http://localhost:8983/solr/select?q=*:*"

You should be able to see the results as xml in the browser.


No comments:

Post a Comment