Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Hosted-services / Azure

Tutorial: Lucene/SOLR on Azure in 5 Minutes

5.00/5 (3 votes)
3 Dec 2013CPOL2 min read 17K  
Running Lucene/SOLR on Windows Azure in 5 minutes

Introduction

This tip shows one how to setup Lucene/SOLR on Windows Azure running Ubuntu 12.04 SLR image in 5 minutes. Hopefully, this can help others to get their Solr up and running on Azure in no time.

Background

It is assumed that the readers are familiar with basic Linux, Lucene/Solr (http://lucene.apache.org/solr/) and know how to configure and setup SOLR on a single Linux box.

Pre-requisites

Before you continue with the next sections, it is advisable to read some basic information from the following links:

Steps

  1. Create Virtual Machine on Azure - Select Ubuntu 12.04 SLR image
  2. SSH to the VM (e.g. ssh azureuser@testvm.cloudapp.net). You must have provided the username and password during the creation of VM.
  3. Once you are on a shell console, download SOLR binary from a href="http://lucene.apache.org/solr/">here:
    > curl -O http://www.webhostingjams.com/mirror/apache/lucene/solr/4.5.1/solr-4.5.1.tgz
  4. Untar the SOLR package:
    > tar -vzxf solr-4.5.1.tgz 
  5. Install java:
    > sudo apt-get install openjdk-6-jdk 
  6. Ready to run the default Solr:
    > cd solr-4.5.1/example
    > java -jar start.jar
  7. Hits your Solr instance: http://<VM-DNS-Name>:8983/solr/browse. You should see the Solr UI up and running if all is setup correctly.
  8. Once you have verified your Solr instance run correctly per step 7, the next step shows you how to run Solr as a service on startup: 
    1. Create a solr-start.sh in default mount point /mnt (preferably to use durable Azure Drive):
      cd solr-4.5.1/example
      java -jar start.jar
    2. Add the solr-start.sh to cron job to be fired on startup:
      > crontab -e (enter) 

      Add the following line to the cron job list:

      @reboot /mnt/solr-start.sh 
    3. Reboot the VM, verify once again your Solr instance is running (see step 7).

NOTE: If you want to run Solr on top of durability storage, you can consider using Azure Drive and copy the Solr to the mounted Azure Drive. The instruction to attach Azure Drive can be found here.

History

  • First version of the tutorial

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)