You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
56
+
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!
57
+
58
+
## Single-command demo
59
+
60
+
For convenience, there is a single command that starts Solr, creates a collection called "demo", and loads sample data into it:
61
+
62
+
```console
63
+
$ docker run --name solr_demo -d -P solr solr-demo
64
+
```
65
+
66
+
## Loading your own data
67
+
68
+
If you want load your own data, you'll have to make it available to the container, for example by copying it into the container:
Run two Solr nodes, linked to the zookeeper container:
109
+
When using the `solr-create` command, Solr will log to the standard docker log (inspect with `docker logs`), and the collection creation will happen in the background and log to `/opt/docker-solr/init.log`.
110
+
111
+
This first way closely mirrors the manual core creation steps and uses Solr's own tools to create the core, so should be reliable.
112
+
113
+
The second way of creating a core at start time is using the `solr-precreate` command. This will create the core in the filesystem before running Solr. You should pass it the core name, and optionally the directory to copy the config from (this defaults to Solr's built-in "basic_configs"). For example:
This method stores the core in an intermediate subdirectory called "mycores". This allows you to use mounted volumes:
121
+
122
+
```console
123
+
$ mkdir mycores
124
+
$ sudo chown 8983:8983 mycores
125
+
$ docker run -d -P -v $PWD/mycores:/opt/solr/server/solr/mycores solr solr-precreate mycore
126
+
```
127
+
128
+
This second way is quicker, easier to monitor because it logs to the docker log, and can fail immediately if something is wrong. But, because it makes assumptions about Solr's "basic_configs", future upstream changes could break that.
129
+
130
+
The third way of creating a core at startup is to use the image extension mechanism explained in the next section.
131
+
132
+
## Using Docker Compose
133
+
134
+
With Docker Compose you can create a Solr container with the index stored in a named data volume. Create a `docker-compose.yml` like:
The docker-solr image has an extension mechanism. At run time, before starting Solr, the container will execute scripts in the `/docker-entrypoint-initdb.d/` directory. You can add your own scripts there either by using mounted volumes or by using a custom Dockerfile. These scripts can for example copy a core directory with pre-loaded data for continuous integration testing, or modify the Solr configuration.
158
+
159
+
Here is a simple example. With a `set-heap.sh` script like:
Then go to `http://localhost:8983/solr/#/~cloud` (adjust the hostname for your docker host) to see the two shards and Solr nodes.
182
+
With this extension mechanism it can be useful to see the shell commands that are being executed by the `docker-entrypoint.sh` script in the docker log. To do that, set an environment variable using Docker's `-e VERBOSE=yes`.
183
+
184
+
## Distributed Solr
185
+
186
+
You can also run a distributed Solr configuration.
187
+
188
+
The recommended and most flexible way to do that is to use Docker networking. See the [Can I run ZooKeeper and Solr clusters under Docker](https://github.com/docker-solr/docker-solr/blob/master/Docker-FAQ.md#can-i-run-zookeeper-and-solr-clusters-under-docker) FAQ, and [this example](docs/docker-networking.md).
189
+
190
+
You can also use legacy links, see the [Can I run ZooKeeper and Solr with Docker Links](Docker-FAQ.md#can-i-run-zookeeper-and-solr-clusters-under-docker) FAQ.
0 commit comments