Skip to content

Commit c01db67

Browse files
authored
Merge pull request #65 from metabrainz/upd-docs
Update the documentation after moving to SolrCloud 9
2 parents b586ed3 + c653591 commit c01db67

5 files changed

Lines changed: 125 additions & 53 deletions

File tree

HACKING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ Solr logs are useful to debug making a search query with MBS and/or indexing doc
5454

5555
In a terminal, follow Solr logs using:
5656

57-
```sh
58-
docker-compose logs -f --tail 1 search
57+
```bash
58+
docker compose logs -f --tail 1 search
5959
```
6060

6161
For an example, browse your local MusicBrainz Server instance at
@@ -73,7 +73,7 @@ Solr Admin
7373
To debug how other components (MBS, SIR) interact with the search server,
7474
the Solr Admin web interface (browsable from <http://localhost:8983>) is your friend.
7575

76-
See “[Getting Started / Solr Admin UI](https://solr.apache.org/guide/solr/latest/getting-started/solr-admin-ui.html)"
76+
See “[Getting Started / Solr Admin UI](https://solr.apache.org/guide/solr/9_7/getting-started/solr-admin-ui.html)"
7777
in the Apache Solr Reference Guide 9.7 for more information.
7878

7979
### Query screen
@@ -124,11 +124,11 @@ Some parameters are automatically set on all queries based on the core configura
124124

125125
Some parameters are set based on the request handler.
126126
These are identified as "invariants", which means that the parameters will always be set to this value even if you specify a different value in the admin interface.
127-
For example the [`basic` request handler](https://github.com/metabrainz/mbsssss/blob/v-2021-05-14/common/requestHandler-basic.xml) erases the `pf` field for good.
127+
For example the [`basic` request handler](https://github.com/metabrainz/mbsssss/blob/v-2025-05-13/common/requestHandler-basic.xml) erases the `pf` field for good.
128128

129129
Some parameters for ranking are set with defaults and can be overridden.
130130
These can be changed by copying them into the relevant fields in the admin query panel to see the resulting change in ranking order.
131-
For example the [release’s request parameters](https://github.com/metabrainz/mbsssss/blob/v-2021-05-14/release/conf/request-params.xml)
131+
For example the [release’s request parameters](https://github.com/metabrainz/mbsssss/blob/v-2025-05-13/release/conf/request-params.xml)
132132
has a default value for the `fl` field which can be overriden if needed
133133
(while the `pf` value will still be erased if used from the `/basic` endpoint).
134134

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ which is included in this file below the License text:
1212

1313
* start-local-solrcloud is derived from start-local-solr
1414
* start-musicbrainz-solrcloud is derived from start-create
15+
* mb-solr/src/main/java/org/musicbrainz/search/analysis/*.java
16+
are adapted almost entirely from the Lucene Core libraries
1517

1618
License
1719
-------

README.md

Lines changed: 117 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,111 @@
1-
# MusicBrainz Solr [![Build Status](https://travis-ci.org/metabrainz/mb-solr.svg?branch=master)](https://travis-ci.org/metabrainz/mb-solr)
1+
# MusicBrainz Solr
22

33
This package includes a
4-
[QueryResponseWriter](https://cwiki.apache.org/confluence/display/solr/Response+Writers)
4+
[QueryResponseWriter](https://solr.apache.org/guide/solr/9_7/query-guide/response-writers.html)
55
for Apache Solr that will generate
66
[mmd-schema](https://github.com/metabrainz/mmd-schema) compliant responses
7-
for Solr cores running on an [mbsssss](https://github.com/mineo/mbsssss) schema.
7+
for Solr cores running on an [mbsssss](https://github.com/metabrainz/mbsssss) schema.
88

9-
## Licensing
9+
## Prerequisites
1010

11-
Note - Part of the code at org.musicbrainz.search.analysis is adapted almost entirely from Lucene core libs.
12-
As such those files are licensed under Apache 2.0 license which is compatible with the existing BSD license of MB-Solr.
11+
In May 2025, Solr data for indexing the whole MusicBrainz database takes ~75 GB of disk space.
12+
Since indexing takes hours, you might want to load the Zstandard-compressed backup archives.
13+
Those archives take ~60 GB of disk space and their temporarily extracted files take ~75 GB more.
14+
Hence, it is currently recommended to provision at least 250 GB of disk space for Solr.
15+
16+
Recommendations:
17+
* RAM: 4 GB
18+
* CPU: 8 threads, x86-64 architecture
19+
* Disk Space: 250 GB (or 100 GB if you don't load backups.)
20+
21+
Required software:
22+
* Git
23+
* Docker 2
24+
(or Java SE 17, Maven 3, and Solr 9.7.0)
1325

1426
## Installation
1527

16-
### Installing brainz-mmd2-jaxb
28+
The generally recommended installation method is using [Docker](https://docs.docker.com).
29+
A Docker image is available through the eponymous [Docker Hub repository](https://hub.docker.com/r/metabrainz/mb-solr) for each release of MusicBrainz Solr.
30+
These images can be used through the [MusicBrainz Docker Compose project](https://github.com/metabrainz/musicbrainz-docker) which comes with instructions.
31+
32+
For [development](#development) or other purposes, these images can also be run alone, see the below subsection “[Installation without MusicBrainz Server](#installation-without-musicbrainz-server)”.
33+
34+
To set up a cluster of Solr nodes, it can be preferred to install to the host system directly, see the below subsection “[Installation without Docker](#installation-without-docker)” and the [Apache Solr Reference Guide 9.7](https://solr.apache.org/guide/solr/9_7/).
35+
36+
### Installation without MusicBrainz Server
37+
38+
Clone the repository with Git:
39+
40+
```bash
41+
git clone --recursive https://github.com/metabrainz/mb-solr.git
42+
```
43+
44+
Run it alone on port 8983 with Docker:
45+
46+
```bash
47+
docker compose up
48+
```
49+
50+
### Installation without Docker
51+
52+
:warning: This section is outdated as it predates upgrading to SolrCloud 9.
53+
54+
:newspaper: The MusicBrainz Solr cluster powering musicbrainz.org is using [Ansible](https://docs.ansible.com/) for deployment.
55+
56+
#### Installing brainz-mmd2-jaxb
1757

1858
Clone the repository with Git:
1959

20-
git clone https://github.com/metabrainz/mmd-schema.git
60+
```bash
61+
git clone https://github.com/metabrainz/mmd-schema.git
62+
```
2163

2264
And install the package:
2365

24-
cd mmd-schema/brainz-mmd2-jaxb
25-
mvn install
66+
```bash
67+
cd mmd-schema/brainz-mmd2-jaxb
68+
mvn install
69+
```
2670

27-
### Installing the query writer
71+
#### Installing the query writer
2872

2973
Clone the repository with Git:
3074

31-
git clone --recursive https://github.com/metabrainz/mb-solr.git
75+
```bash
76+
git clone --recursive https://github.com/metabrainz/mb-solr.git
77+
```
3278

3379
Navigate to the **mb-solr** folder in a terminal and build a JAR
3480
file:
3581

36-
mvn package
82+
```bash
83+
mvn package
84+
```
3785

3886
This will create a file called
3987
**solrwriter-0.0.1-SNAPSHOT-jar-with-dependencies.jar** in the **target** folder.
4088

4189
Now you need to make this JAR file available to all Solr cores that need it.
4290
The easiest option is to configure a **sharedLib** in your
43-
[solr.xml](https://cwiki.apache.org/confluence/display/solr/Format+of+solr.xml)
91+
[solr.xml](https://solr.apache.org/guide/solr/9_7/configuration-guide/configuring-solr-xml.html)
4492
and put the JAR file into that.
4593

4694
All that's left to do now is enabling the Query Response Writers in your cores
47-
[solrconfig.xml](https://cwiki.apache.org/confluence/display/solr/Configuring+solrconfig.xml).
95+
[solrconfig.xml](https://solr.apache.org/guide/solr/9_7/configuration-guide/configuring-solrconfig-xml.html).
4896
To do that, add the following lines as children of the **config** element:
4997

5098
```xml
51-
<queryResponseWriter name="mbxml" class="org.musicbrainz.search.solrwriter.MBXMLWriter">
52-
<str name="entitytype">$entitytype</str>
53-
</queryResponseWriter>
54-
<queryResponseWriter name="mbjson" class="org.musicbrainz.search.solrwriter.MBJSONWriter">
55-
<str name="entitytype">$entitytype</str>
56-
</queryResponseWriter>
99+
<queryResponseWriter name="mbxml" class="org.musicbrainz.search.solrwriter.MBXMLWriter">
100+
<str name="entitytype">$entitytype</str>
101+
</queryResponseWriter>
102+
<queryResponseWriter name="mbjson" class="org.musicbrainz.search.solrwriter.MBJSONWriter">
103+
<str name="entitytype">$entitytype</str>
104+
</queryResponseWriter>
57105
```
58106

59107
The solrconfig.xml of the cores defined by
60-
[mbsssss](https://github.com/mineo/mbsssss) already includes this snippet, as
108+
[mbsssss](https://github.com/metabrainz/mbsssss) already includes this snippet, as
61109
well as the **sharedLib** configuration in the solr.xml file.
62110

63111
**$entitytype** needs to be replaced by the entity type of the documents in the store.
@@ -69,7 +117,6 @@ Valid values are:
69117
- cdstub
70118
- editor
71119
- event
72-
- freedb
73120
- instrument
74121
- label
75122
- place
@@ -83,37 +130,70 @@ Valid values are:
83130

84131
Now the core needs to be reloaded.
85132
After that, two new values for the
86-
[wt paramter](https://cwiki.apache.org/confluence/display/solr/Response+Writers)
133+
[wt paramter](https://solr.apache.org/guide/solr/9_7/query-guide/common-query-parameters.html#wt-parameter)
87134
are available:
88135

89136
- **mbxml**, which returns mmd-compliant XML documents
90-
- **mbjson**, which returns JSON document as described by
91-
[this page](https://beta.musicbrainz.org/doc/Development/JSON_Web_Service)
137+
- **mbjson**, which returns JSON document as described by the
138+
[MusicBrainz API documentation page](https://musicbrainz.org/doc/MusicBrainz_API)
92139

93140
At the moment, the
94-
[field list](https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters#CommonQueryParameters-Thefl)
141+
[field list](https://solr.apache.org/guide/solr/9_7/query-guide/common-query-parameters.html#fl-field-list-parameter)
95142
parameter of each query needs to include the **score** field for the code to
96143
work correctly.
97144

98145
A branch of the MusicBrainz server that can query a Solr server with this
99146
QueryResponseWriter is available on
100147
[GitHub](https://github.com/mineo/musicbrainz-server/tree/solr-search).
101148

102-
### Known Vulnerabilities
149+
## Development
103150

104-
- [CVE-2021-44228](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228):
105-
It can be mitigated by setting the environement variable `LOG4J_FORMAT_MSG_NO_LOOKUPS=true`.
151+
If you followed “[Installation without MusicBrainz Server](#installation-without-musicbrainz-server)”,
152+
just stop the last command and run it again after having made some changes.
106153

107-
## Docker Installation
154+
Otherwise, if you need it to be tested with either the indexer or MusicBrainz Server:
108155

109-
Clone the repository with Git:
156+
1. Make some changes in your local Git clone (of MusicBrainz Solr)
157+
(The two next steps are optional but recommended to better identify images.)
158+
2. Commit these changes to your local Git branch.
159+
3. Tag this commit with a meaningful version:
160+
161+
```bash
162+
git tag adastrawberry-1969
163+
```
164+
165+
4. Build a docker image:
110166

111-
git clone --recursive https://github.com/metabrainz/mb-solr.git
167+
```bash
168+
./build.sh
169+
```
112170

113-
Either run it alone on port 8983:
171+
5. Use this tag to [set `MB_SOLR_VERSION` in MusicBrainz Docker Compose project](https://github.com/metabrainz/musicbrainz-docker?tab=readme-ov-file#local-development-of-musicbrainz-solr).
114172

115-
docker-compose up
173+
See also [The Debugger’s Guide to MusicBrainz Solr](HACKING.md).
116174

117-
Or build a tagged image to run with [MusicBrainz Docker](https://github.com/metabrainz/musicbrainz-docker):
175+
## Helper commands
176+
177+
SolrCloud collections backups from the MusicBrainz Solr cluster
178+
powering musicbrainz.org are made available twice a week to save
179+
mirror owners the initial cost of indexing the whole MusicBrainz data
180+
from scratch which can take hours and significant resources.
181+
Those backups are provided as Zstandard-compressed tar archives.
182+
Helper commands to handle these archives are provided in Docker images:
183+
184+
```bash
185+
fetch-backup-archives
186+
load-backup-archives
187+
remove-backup-archives
188+
```
189+
190+
In May 2025, the measured time for fetching 60 GB was 12 min (depending on your bandwidth,)
191+
and the measured time for loading was 12 min (depending on your CPU/RAM/Disk speed.)
192+
193+
A fourth helper command allows to delete all the Solr data if needed:
194+
195+
```bash
196+
delete-indexed-documents
197+
```
118198

119-
./build.sh
199+
Each of these commands is self-documented through the option `--help`.

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ services:
88
build:
99
context: .
1010
dockerfile: Dockerfile
11+
mem_swappinness: 1
1112
ports:
1213
- "127.0.0.1:8983:8983"
1314
volumes:

mb-solr/src/main/resources/oxml.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<xml-element java-attribute="recordingList" xml-path="."/>
1919
<xml-element java-attribute="urlList" xml-path="."/>
2020
<xml-element java-attribute="cdstubList" xml-path="."/>
21-
<xml-element java-attribute="freedbDiscList" xml-path="."/>
2221
<xml-element java-attribute="releaseList" xml-path="."/>
2322
<xml-element java-attribute="tagList" xml-path="."/>
2423
<xml-element java-attribute="workList" xml-path="."/>
@@ -235,16 +234,6 @@
235234
<xml-element java-attribute="trackList" xml-path="."/>
236235
</java-attributes>
237236
</java-type>
238-
<java-type name="FreedbDiscList">
239-
<java-attributes>
240-
<xml-element java-attribute="freedbDisc" name="freedb-discs"/>
241-
</java-attributes>
242-
</java-type>
243-
<java-type name="FreedbDisc">
244-
<java-attributes>
245-
<xml-element java-attribute="trackList" xml-path="."/>
246-
</java-attributes>
247-
</java-type>
248237
<java-type name="LabelInfoList">
249238
<java-attributes>
250239
<xml-element java-attribute="labelInfo" name="label-info"/>

0 commit comments

Comments
 (0)