Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gravityblast/mbslave

Fork of https://bitbucket.org/lalinsky/mbslave
https://github.com/gravityblast/mbslave

Last synced: about 10 hours ago
JSON representation

Fork of https://bitbucket.org/lalinsky/mbslave

Awesome Lists containing this project

README

        

# MusicBrainz Database Setup

This repository contains a collection of scripts that can help you setup a local
copy of the MusicBrainz database and keep it up to date. There is no script that
does everything for you though. The main motivation for writing these scripts was
to customize the database, so the way to install the database might differ from
user to user.

## Installation

0. Make sure you have [Python](http://python.org/) and [psycopg2](http://initd.org/psycopg/) installed.

1. Setup a database and create `mbslave.conf` by copying and editing
mbslave.conf.default. If you are starting completely from scratch,
you can use the following commands to setup a clean database:

sudo su - postgres
createuser musicbrainz
createdb -l C -E UTF-8 -T template0 -O musicbrainz musicbrainz
createlang plpgsql musicbrainz

2. Prepare empty schemas for the MusicBrainz database and create the table structure:

echo 'CREATE SCHEMA musicbrainz;' | ./mbslave-psql.py -S
echo 'CREATE SCHEMA statistics;' | ./mbslave-psql.py -S
echo 'CREATE SCHEMA cover_art_archive;' | ./mbslave-psql.py -S
echo 'CREATE SCHEMA wikidocs;' | ./mbslave-psql.py -S
echo 'CREATE SCHEMA documentation;' | ./mbslave-psql.py -S
./mbslave-remap-schema.py >/var/log/mbslave.log
```

## Upgrading

When the MusicBrainz database schema changes, the replication will stop working.
This is usually announced on the [MusicBrainz blog](http://blog.musicbrainz.org/).
When it happens, you need to upgrade the database.

### Release 2014-05-14 (20)

Download some new data to import:

```sh
wget http://ftp.musicbrainz.org/pub/musicbrainz/data/schema-change-2014-05/mbdump-derived.tar.bz2
wget http://ftp.musicbrainz.org/pub/musicbrainz/data/schema-change-2014-05/mbdump-documentation.tar.bz2
```

Import the data dumps:

```sh
echo 'TRUNCATE TABLE release_tag;' | ./mbslave-psql.py
./mbslave-import.py mbdump-derived.tar.bz2
./mbslave-import.py mbdump-documentation.tar.bz2
```

Run the upgrade scripts:

```sh
./mbslave-remap-schema.py /tmp/mbslave-solr-data.xml

Once you have generated this file, you for example start a local instance of Solr:

java -Dsolr.solr.home=/path/to/mbslave/solr/ -jar start.jar

Import the XML file:

curl http://localhost:8983/solr/musicbrainz/update -F stream.file=/tmp/mbslave-solr-data.xml -F commit=true

Install triggers to queue database updates:

echo 'CREATE SCHEMA mbslave;' | ./mbslave-psql.py -S
./mbslave-remap-schema.py