Solr with docker

Submitted by rnsrk on Thu, 10/28/2021 - 10:30

Prerequisites

Installation

Linux/ MacOS

Open a terminal and create a solrdata-directory ... is the place where want to store the Solr data, i. e. ~/solrdata (on Linux/MaxOS) or C:\solrdata (on Windows). and change to home directory, i. e. with

mkdir ~/solrdata && cd ~ 

(on Linux change permissions with sudo chown 8983:8983 ~/solrdata)

Create and start a docker container with your solr-container-name ... is the name of your Solr container, i. e. my_solr. , i. e. with

docker run -d -v "$PWD/solrdata:/var/solr" -p 8983:8983 --name my_solr solr:8 solr-precreate gettingstarted

this will create a core called gettingstarted on the fly, you will need him as a dummy-core ... is the initial core in order to download the Solr server config from your Drupal instance, i. e. gettingstarted. .

Windows

Create a solrdata-directory ... is the place where want to store the Solr data, i. e. ~/solrdata (on Linux/MaxOS) or C:\solrdata (on Windows). . Open a Powershell and change to the parent solrdata-directory ... is the place where want to store the Solr data, i. e. ~/solrdata (on Linux/MaxOS) or C:\solrdata (on Windows). , i. e. with

cd C:\

 Create and start a docker container with your  solr-container-name ... is the name of your Solr container, i. e. my_solr. , i. e. with

docker run -d -v "C:\solrdata:/var/solr" -p 8983:8983 --name my_solr solr:8 solr-precreate gettingstarted

this will create a core called gettingstarted on the fly, you will need him as a dummy-core ... is the initial core in order to download the Solr server config from your Drupal instance, i. e. gettingstarted. .

Usage

Please note that you have to use the docker run command just one time to create the container. If you restart your system you have to use the docker start command!

The basic operations for your container are:

  • docker start solr-container-name ... is the name of your Solr container, i. e. my_solr. -d: start your container daemonized, that means in the background.
  • docker logs solr-container-name ... is the name of your Solr container, i. e. my_solr. : show the log files, so you can look for errors etc.
  • docker ps: shows all running container (add -a to show all containers).
  • docker stop solr-container-name ... is the name of your Solr container, i. e. my_solr. : stops the container.
  • docker rm solr-container-name ... is the name of your Solr container, i. e. my_solr. : removes the container.

Check results

Type http://localhost:8983/ in the adress field of your browser to open the Solr dashboard and should have the possibility to select your you will need him as a dummy-core ... is the initial core in order to download the Solr server config from your Drupal instance, i. e. gettingstarted. . Read more about Solr docker at its Github page.

Was this reply helpful?
0
0
No votes have been submitted yet.

Need help?