• Products
    • Overview
    • LucidWorks Search Platform
      • Features and Benefits
      • Technical Overview
      • Only with LucidWorks
      • LucidWorks and Solr
      • White Papers
      • LucidWorks Enterprise
      • LucidWorks Cloud
      • LucidWorks Big Data
    • Apache Releases
      • Apache Solr 4.0-dev
      • Apache Lucene
  • Support & Services
    • Overview
    • Support
    • Lucid University
    • ExpertLink Advisory
    • Consulting
    • Partners
    • Subscriptions
  • Why Lucid?
    • Why Lucid?
    • Technology
    • Who uses Lucene/Solr?
      • What customers are saying
    • Case Studies
    • Whitepapers
    • Demos
    • Webinars
  • Blog
  • DevZone
    • DevZone Overview
    • Forums (LWE)
    • Videos & Podcasts
      • How To's
      • Screencasts
      • Podcasts
      • Conference Videos
    • Technical Articles
      • Whitepapers
    • Reference Materials
      • Documentation
      • Solr Reference Guide
      • Solr & LucidWorks Matrix
      • Tutorials
    • Events
      • Lucene Revolution
      • Tradeshows & Conferences
      • Meet Ups
    • Code & Test
  • Downloads
  • About Us
    • Management
    • Board of Directors
    • Apache Lucene/Solr Committers
    • Careers
    • News
      • Media Coverage
      • Press Releases
    • Contact Us
Sign Up or Log In
Home . Blog

August 10, 2011

Running Solr as a Service on Linux

Posted by Mark Miller

Let’s install Solr as a service on Linux. I’m using Ubuntu 11.04.

 

First download the latest version of Solr from (3.3 as of this writing): http://www.apache.org/dyn/closer.cgi/lucene/solr/

 

Extract the compressed zip or tgz file to where you would like Solr to live.

 

Currently, I like using runit to run Linux services. http://smarden.org/runit/

 

Install runit with: sudo apt-get install runit


 

Create a new service directory.

 

 

 

Create a new shell script called run in the new /etc/sv/solr directory. You will need to have root permission to work in these directories, so use sudo. In this case, I want to run Solr as the user ‘mark’.

 

 


Make the run script executable.

 

Let runit know about the new service.

 

Now Solr should be up and running. If it dies or you kill it, it will automatically be restarted. If the server is restarted, Solr will be launched on startup.

 

To stop the service: sudo sv stop solr

To start the service: sudo sv start solr

 

Great.

 

Logging

 

By default, Solr logs to STD ERROR. You likely want to add a log configuration file to have the most control over how Solr logs – see http://wiki.apache.org/solr/LoggingInDefaultJettySetup. To be lazy though (and perhaps safe), let’s make sure STD OUT and STD ERR are nicely logged for us by runit.

This method just logs STD OUT, so lets first edit our Solr run script to redirect STD ERR to STD OUT

 

 

Now create a new directory called log in the /etc/sv/solr service directory. Inside this, create another script called run. This script will start the log service, run it under the user mark, and put the log files in the log directory we just made (we use . for the current working directory).

 

 

As we are running as mark, change the owner of the log dir to mark so that the log files can be created: sudo chown mark log

Now make the new run script executable.

 

The next time runit starts, Solr logs will be logged to the /etc/sv/solr/log/current file and auto rolled for you.

 

 

 

  • Share this:
  • Email
  • Facebook
  • Digg
  • Share
  • Print
  • Reddit
  • StumbleUpon

Category: Uncategorized

Tags: Mark Miller, Solr

Leave a Reply

Go to Blog Front Page

  • Recent Posts

    • Solr 4 preview: SolrCloud, NoSQL, and more
    • Lucene Revolution 2012: Presentation slides are now available
    • Calling all Big Data analysts
    • Stump The Chump Updates
    • Once a Chump, Always a Chump
    • What is the big deal about BIG DATA?
    • Cloud Search: a David and Goliath battle
    • Lucene / Solr 3.6 released
    • What is Big Data? More importantly, what is Big Data not?
    • Memory comparisons between Solr 3x and trunk
  • Archives

    • May 2012
    • April 2012
    • March 2012
    • February 2012
    • January 2012
    • December 2011
  • Tags

    apache Apache Mahout best practices Big data chump Cloud Computing code4lib dismax enterprise search Erik Hatcher field collapsing frange function query Grant Ingersoll hoss isfdb Lucene lucene revolution lucid imagination lucidworks Mahout Mark Miller memory NoSQL Open Source Open Source Search qparser query parser Rails realtime result grouping Richmond Ruby schema design sint Solr solr 3.1 solr 4.0 solr cloud sortable spatial search Tika transaction log unstructured search VA
  • Contact Us
  • About Lucid Imagination
  • Help & Support
  • Training
  • Privacy Policy
  • Legal Terms of Use
  • Copyrights and Disclaimers
  • Log in

Apache Solr, Solr, Apache Lucene, Lucene and their logos are trademarks of the Apache Software Foundation.

© 2011 Lucid Imagination. All Right reserved.

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.