Skip to content
justinsb edited this page Apr 26, 2012 · 3 revisions

Let's run Solr as a service!

This assumes that you've followed the steps in Installation, and Configure Your Cloud.

Create a Solr server

For solr, we create a SolrCluster object. Right now, that just creates a single server (but lets us add more functionality later on).

# Create an alias if you don't have one yet
alias pl='~/platformlayer/bin/pl'

# Create our solr cluster
pl put-item solrCluster/solr1 "{ 'dnsName': 'solr1.platformlayer.org' }"

PlatformLayer goes off and does lots of work; monitor completion using pl list-roots and pl list-jobs.

We need a firewall rule. For testing purposes (only), just open it up to the entire Internet (for production, use your IP.

# Open port to the world (0.0.0.0/0) (ONLY FOR DEMOS!)
pl put-item networkConnection/solr1-world "{ 'sourceCidr': '0.0.0.0/0', 'destItem': 'solrCluster/solr1', 'port': 8080 }"

# Show all top-level objects
pl list-roots

Once pl list-roots is all green, solr should be up and running.

# Get the endpoint
pl get-endpoint solrCluster/solr1

# Outputs:
#  <someip>:8080

Open your browser to http://:8080/solr/admin to see your search-as-a-service!

There's also a test which shows how to use the Java client binding, along with setting up custom fields. Fields will be defined automatically be solr based on the suffix (e.g. *_t defines a text field, *_i defines an integer field). Sometimes you want to define your fields explicitly though, and PlatformLayer lets you do that.

Cleaning up

pl delete-item networkConnection/solr1-world
pl delete-item solrCluster/solr1

Clone this wiki locally