Skip to content

gileshinchcliff/docker-solr

 
 

Repository files navigation

Solr Docker Container

Build Status GitHub version Docker Repository on Quay.io

This is a docker container for Solr.

Getting Started

These instructions will cover usage information and for the docker container

Prerequisites

In order to run this container you'll need docker installed.

Usage

Container Parameters

To run a single Solr server:

docker run --name my_solr -d -p 8983:8983 -t quay.io/ukhomeofficedigital/solr:$CONTAINER_VERSION

Then with a web browser go to http://localhost:8983/ to see the Admin Console (adjust the hostname for your docker host).

To use Solr, you need to create a "core", an index for your data. For example:

docker exec -it --user=solr my_solr bin/solr create_core -c gettingstarted

In the web UI if you click on "Core Admin" you should now see the "gettingstarted" core.

If you want to load some example data:

docker exec -it --user=solr my_solr bin/post -c gettingstarted example/exampledocs/manufacturers.xml

In the UI, find the "Core selector" popup menu and select the "gettingstarted" core, then select the "Query" menu item. This gives you a default search for ":" which returns all docs. Hit the "Execute Query" button, and you should see a few docs with data. Congratulations!

To learn more about Solr, see the Apache Solr Reference Guide.

Distributed Solr You can also run a distributed Solr configuration, with Solr nodes in separate containers, sharing a single ZooKeeper server:

Run ZooKeeper, and define a name so we can link to it:

docker run --name zookeeper -d -p 2181:2181 -p 2888:2888 -p 3888:3888 jplock/zookeeper

Run two Solr nodes, linked to the zookeeper container:

docker run --name solr1 --link zookeeper:ZK -d -p 8983:8983 \
      quay.io/ukhomeofficedigital/solr:$CONTAINER_VERSION \
      bash -c '/opt/solr/bin/solr start -f -z $ZK_PORT_2181_TCP_ADDR:$ZK_PORT_2181_TCP_PORT'
docker run --name solr2 --link zookeeper:ZK -d -p 8984:8983 \
      quay.io/ukhomeofficedigital/solr:$CONTAINER_VERSION \
      bash -c '/opt/solr/bin/solr start -f -z $ZK_PORT_2181_TCP_ADDR:$ZK_PORT_2181_TCP_PORT'

Create a collection:

docker exec -i -t solr1 /opt/solr/bin/solr create_collection \
        -c collection1 -shards 2 -p 8983

Then go to http://localhost:8983/solr/#/~cloud (adjust the hostname for your docker host) to see the two shards and Solr nodes.

Environment Variables

  • ZK_HOST (Optional) The ZooKeeper connection string your current SolrCloud nodes use to connect to ZooKeeper; this value will be the same for all nodes in the cluster.
  • SOLR_HOST (Optional) The hostname each Solr node used to register with ZooKeeper when joining the SolrCloud cluster; this value will be used to set the host Java system property when starting the new Solr 5 process.
  • SOLR_PORT (Optional) The port each Solr node is listening on, such as 8983.
  • OVERRIDE_SOLR_PORT (Optional) Sets SOLR_PORT on runtime.
  • SOLR_HOME (Optional) The absolute path to the Solr home directory for each Solr node; this directory must contain a solr.xml file

Built With

  • Solr 5.3.1

Find Us

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This is based off the official Solr container, and we have included much of the text and code they provide.

The primary changes made to this repository is to allow us to base this image of our parent image, rather than one provided.

We have sublicensed this variant under the GPLv2 License - see the LICENSE.md file for details. You can find the Apache v2.0 license they distribute that code with at ORIGINAL-LICENSE.md.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%