You are here

Status message

The page you requested does not exist. A search for 2009 OR 04 OR oracle OR is OR buying OR sun resulted in this page.

Jetty Powered MultiCore Apache Solr

Installing the latest version of Apache Solr search engine on a Jetty powered server is very straightforward. You simply copy the packages in the right place, change a few lines to customize it and you are done. This tutorial is meant for Ubuntu users but it can be easily adapted for other distributions.

Assuming you are root (you can become by running "sudo -i" command), the first thing you need to do is get the dependencies:

apt-get update && apt-get upgrade
apt-get install openjdk-6-jdk

I recommend the java development kit from Ubuntu but if you want you can also use the one made by Sun (replace "natty" with your own distribution codename):

add-apt-repository "deb http://archive.canonical.com/ natty partner"
apt-get install sun-java6-jdk

Download and extract the Jetty server into the /opt folder (Visit http://download.eclipse.org/jetty/ for the latest version):

JETTY_VERSION=7.4.5.v20110725
cd /opt
wget http://download.eclipse.org/jetty/$JETTY_VERSION/dist/jetty-distribution-$JETTY_VERSION.tar.gz
tar xfz jetty-distribution-$JETTY_VERSION.tar.gz
mv jetty-distribution-$JETTY_VERSION jetty

Download and extract the Apache Solr application into a temporary folder. We don't need the embedded jetty because we have our own. The URL provided is just a mirror so it's best to visit http://lucene.apache.org/solr/ for the latest version and a faster download link:

SOLR_VERSION=3.3.0
cd /tmp
wget http://mirrors.kahuki.com/apache//lucene/solr/$SOLR_VERSION/apache-solr-$SOLR_VERSION.tgz
tar zxvf apache-solr-$SOLR_VERSION.tgz

Next, we need to copy the actual Solr application into Jetty:

cp apache-solr-$SOLR_VERSION/dist/apache-solr-$SOLR_VERSION.war /opt/jetty/webapps/solr.war
cp -R apache-solr-$SOLR_VERSION/example/solr /opt

Before we start the server we need to add a few options to java:

echo "JETTY_USER=jetty
JAVA_OPTIONS=\"-Dsolr.solr.home=/opt/solr\""
>> /etc/default/jetty

By modifying the java_options line you can customize/optimize even more or Java environment, but that's outside the scope of this tutorial. For example:

JAVA_OPTIONS="-Xms16m -Xmx64m -Djava.awt.headless=true -Dsolr.solr.home=/opt/solr"

We also need to create the multicore config for Solr:

mkdir -p /opt/solr/example1.com/data
mkdir -p /opt/solr/example2.com/data

cp -R /opt/solr/conf /opt/solr/example1.com
cp -R /opt/solr/conf /opt/solr/example2.com

And modify /opt/solr/solr.xml accordingly:

<cores adminPath="/admin/cores" defaultCoreName="collection1">
  <core name="Example1" instanceDir="example1.com" />
  <core name="Example1" instanceDir="example1.com" />
</cores>

One last thing is to create the user under which all this will run, set the right permissions and check if everything is in order with Jetty:

adduser --system --no-create-home --disabled-login --disabled-password --group jetty

chown -R jetty:jetty /opt/jetty
chown -R jetty:jetty /opt/solr

/opt/jetty/bin/jetty.sh check

If everything is in order you can start Jetty and even configure it to run at bootup:

/opt/jetty/bin/jetty.sh start

ln -s /opt/jetty/bin/jetty.sh /etc /init.d/jetty
update-rc.d -f jetty defaults

That's it; you now have the latest Apache Solr engine on the latest Jetty web server.


If you found this useful and you want to contribute, please consider sending a donation (click the button below).

Comments

Very good and detailed report. Thanks! But I have one question: Why did you install Solr from sources instead of the ubuntu package "solr-jetty"? Best regards, Dirk
Vlad's picture

That's because I like having the latest version of the software I use. And the Ubuntu solr-jetty package is still 1.4.0+ds1-2ubuntu1 instead of 1.4.1 found on their site. Especially when the Solr package comes in a simple .war file which you copy in your jetty webapps folder.

Hello Thanks for your nice tuts. The apache solr is working properly for every cores Is it normal to get this error when i try to access to solr url http://creatiledev.net:8080/solr/ HTTP ERROR 500 Problem accessing /solr/index.jsp. Reason: JSP support not configured
Vlad's picture

If you didn't modify any of the start-up scripts in your jetty distro then most likely you need to set the permissions for the jetty user to the Solr folder:

chown -R jetty:jetty /usr/share/solr

Thanks for this article. Regarding the JSP support,
# aptitude install libjetty-extra
fixed this error for me on Debian Squeeze

Thanks a lot this package fixed my error

http://apache.oss.eznetsols.org/lucene/solr/3.1.0/ Will you update this doc for solr 3.1.0 Is there any different install 3.1.0 from 1.4.1

Yes, why not solr 3.1.0? Is there a way to check the versions of jetty or solr being used if you already have these installed?
Vlad's picture

I updated the tutorial with the latest version of Jetty and Solr.

And modify /opt/solr/solr.xml accordingly: BLANK ?

Pages

Add new comment

Recent comments