Running SOLR as a daemon on Mac

aduston edited this page May 24, 2011 · 7 revisions
wget http://mirror.metrocast.net/apache//lucene/solr/1.4.1/apache-solr-1.4.1.tgz
tar xvzf apache-solr-1.4.1.tgz
sudo mv apache-solr-1.4.1 /usr/lib/apache-solr/
sudo mkdir -p /var/log/apache-solr/
sudo chmod a+w /var/log/apache-solr/
cp /usr/lib/apache-solr/example/solr/conf/*.txt /usr/lib/apache-solr/example/multicore/core0/conf/
cp /usr/lib/apache-solr/example/solr/conf/*.txt /usr/lib/apache-solr/example/multicore/core1/conf/

Then add plist file ~/Library/LaunchAgents/org.apache.Solr.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>org.apache.Solr</string>
        <key>OnDemand</key>
        <true/>
        <key>WorkingDirectory</key>
        <string>/usr/lib/apache-solr/example/</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/bin/java</string>
                <string>-Dsolr.solr.home=multicore</string>
                <string>-jar</string>
                <string>start.jar</string>
        </array>
        <key>ServiceDescription</key>
        <string>Apache Solr Server</string>
        <key>StandardErrorPath</key>
        <string>/var/log/apache-solr/solr-error.log</string>
        <key>StandardOutPath</key>
        <string>/var/log/apache-solr/solr-output.log</string>
</dict>
</plist>

Start the daemon:

launchctl load ~/Library/LaunchAgents/org.apache.Solr.plist
launchctl start org.apache.Solr

You can check your work by visiting http://127.0.0.1:8983/solr/ in your web browser. Finally, you’ll need to add a symlink relative to the unisubs project directory (aka mirosubs directory):

ln -s /usr/lib/apache-solr/example/ ../buildout/parts/solr/example