Setting up Solr was a bit different then the others. Solr’s distribution is multifaceted, containing multiple server examples, client code, as well as, a simple production ready server. So let me start off with a few steps I took in setting up Solr.

  1. Download and extract latest binary from solr website.
  2. Within solr folder is examples/
  3. Remove example-DIH/
  4. Remove exampledocs/
  5. Create directory /opt/local/share/solr-VERSION (solr-1.4 at time of this writing)
  6. Copy contents of examples to /opt/local/share/solr-VERSION
  7. Create a symlink /opt/local/share/solr-VERSION -> solr

And here is the SMF:

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM
'/usr/share/lib/xml/dtd/service_bundle.dtd.1'>

<service_bundle type='manifest' name='Solr'>

<service
	name='network/solr'
	type='service'
	version='1'>

	<create_default_instance enabled='false'/>
    <single_instance/>

	<dependency name='fs'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri
			value='svc:/system/filesystem/local'/>
    </dependency>

    <dependency name='net'
		grouping='require_all'
		restart_on='none'
		type='service'>
		<service_fmri value='svc:/network/loopback'/>
    </dependency>

    <dependent name='solr_multi-user'
	 	grouping='optional_all'
		restart_on='none'>
		<service_fmri value='svc:/milestone/multi-user'/>
    </dependent>

    <exec_method
		name='start'
		type='method'
		exec='/opt/local/lib/svc/method/svc-solr'
		timeout_seconds='60'>

		<method_context working_directory='/opt/local/share/solr'>
        	<method_credential user='root' group='root' />
      	</method_context>
    </exec_method>

    <exec_method
		name='stop'
		type='method'
		exec=':kill'
		timeout_seconds='60'>
    </exec_method>

	<template>
		<common_name>
			<loctext xml:lang='C'>
				solr
			</loctext>
		</common_name>
	</template>

</service>
</service_bundle>

And the very short script it calls to start Solr:

svc-solr:

#!/bin/sh                                                                                 

nohup java -Dsolr.data.dir=/opt/local/share/solr/data -jar start.jar &

That’s about it.

About the Author:

Learned something? Great! Need help on your development project? I'm available for hire:

  • Ruby on Rails
  • iOS Development
  • System Architecture & Performance

Get in touch:

Discussion

No comments yet, be the first.

Leave a Comment