Skip to content

Commit

Permalink
Ref Guide: Docker, add headings (apache#263)
Browse files Browse the repository at this point in the history
* Add sub-headers to "Creating cores" section
* Add custom configset example to solr-precreate section

docker-solr/docker-solr#383

Co-authored-by: Kirill Roskolii <roskoliy.kirill@gmail.com>
Co-authored-by: Houston Putman <houston@apache.org>
  • Loading branch information
3 people authored Aug 22, 2021
1 parent 919ad85 commit df1fd2a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions solr/solr-ref-guide/src/solr-in-docker.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ When Solr runs in standalone mode, you create "cores" to store data.
On a non-Docker Solr, you would run the server in the background, then use the <<solr-control-script-reference.adoc#,Solr control script>> to create cores and load data.
With Solr docker you have various options.

==== Manually

The first is exactly the same: start Solr running in a container, then execute the control script manually in the same container:

[source,bash]
Expand All @@ -116,16 +118,27 @@ docker exec -it my_solr solr create_core -c gettingstarted
----

This is not very convenient for users, and makes it harder to turn it into configuration for Docker Compose and orchestration tools like Kubernetes.

==== Using solr-precreate Command

So, typically you will use the `solr-precreate` command which prepares the specified core and then runs Solr:

[source,bash]
----
docker run -d -p 8983:8983 --name my_solr solr solr-precreate gettingstarted
----

The `solr-precreate` command takes an optional extra argument to specify a configset directory below `/opt/solr/server/solr/configsets/`.
This allows you to specify your own config.
See /~https://github.com/docker-solr/docker-solr-examples/tree/master/custom-configset[this example].
The `solr-precreate` command takes an optional extra argument to specify a configset directory below `/opt/solr/server/solr/configsets/` or you can specify a full path to a custom configset inside the container:

[source,bash]
----
docker run -d -p 8983:8983 --name my_solr -v $PWD/config/solr:/my_core_config/conf solr:8 solr-precreate my_core /my_core_config
----

N.B. When specifying the full path to the configset, the actual core configuration should be located inside that directory in the `conf` directory.
See <<config-sets.adoc#,Configsets>> for details.

==== Using solr-create Command

The third option is to use the `solr-create` command.
This runs a Solr in the background in the container, then uses the Solr control script to create the core, then stops the Solr server and restarts it in the foreground.
Expand All @@ -136,6 +149,8 @@ This method is less popular because the double Solr run can be confusing.
docker run -d -p 8983:8983 --name my_solr solr solr-create -c gettingstarted
----

==== Custom Set-Up Scripts

Finally, you can run your own command-line and specify what to do, and even invoke mounted scripts.
For example:

Expand Down

0 comments on commit df1fd2a

Please sign in to comment.