NGS Server Setup: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
m (Redirecting to MusicBrainz Server/Setup)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
#REDIRECT [[MusicBrainz Server/Setup]]
__NOTOC__
<small>[[Products]] > [[MusicBrainz Server]] > NGS Server Setup</small>

== Next Generation MusicBrainz Server ==

To set up a Next Generation Schema (NGS) MusicBrainz server, you can choose to download and setup a virtual machine image of NGS or you can install the server into your own Linux instance.

== MusicBrainz NGS Virtual Server Image ==

Running an NGS virtual machine requires some Linux knowledge, but it vastly simpler than installing NGS from scratch. To use the virtual machine instance, follow these steps:

# Start downloading the latest [http://ftp.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202011-07-20.ova virtual machine instance] ([http://ftp.uk.musicbrainz.org/pub/musicbrainz/vm/MusicBrainz%20NGS%202011-07-20.ova UK mirror]). Beware: This is a large (5Gb) download!
# Download and install [http://virtualbox.org Virtual Box] on your machine.
# Start Virtual Box and choose ''Import Appliance'' from the File menu. Select the downloaded file.
# Once Virtual Box has imported the appliance, select the imported virtual machine from the list of virtual machines and click on Start.
# Once the instance has started up, log in on the console using the username ''musicbrainz'' and password ''musicbrainz''. This account has sudo privileges -- if you would like to set a root passwd, you can do that via sudo.
# Run ''ifconfig'' and look at the ''inet addr'' for eth0. This is the IP address of your virtual machine. Note this IP address.
# Optional: The console for Virtual Box is very slow. I find it faster to SSH into the virtual box with a good terminal program.
# Copy lib/DBDefs.pm.default to lib/DBDefs.pm, and update MB_SERVER_ROOT and DEVELOPMENT_SERVER values
# To start the NGS server, enter these commands:

musicbrainz@clear:~$ cd musicbrainz-server/script
musicbrainz@clear:~/musicbrainz-server/script$ ./musicbrainz_server.pl -r

Now you can reach the MusicBrainz server by pointing your browser to port 3000 of the IP address in step 6. If your IP address from step 7 was: 10.1.1.104, then point your browser to http://10.1.1.104:3000

=== Troubleshooting ===

If you update the code base in this version of the virtual server, you may encounter an error that complains about DEVELOPMENT_SERVER not being defined, please add this line to your lib/DBDefs.pm file:

sub DEVELOPMENT_SERVER { 1 }

And then start the server.

=== Running Replication ===

This VM has replication enabled and to have the database catch up with the latest replication packets, do this:

cd musicbrainz-server/admin/replication
./LoadReplicationChanges

This will load all of the changes to the database since the VM update. To automate this, add this script to a cron job that fires off 10 minutes after each hour. NOTE: Loading replication changes might take a long time. If the VM is more than a couple of weeks old, it might be better for you to import a fresh data set. Check the INSTALL file for how to import new data.

=== Accessing the database ===

To access the main postgres database, you can do this:

cd musicbrainz-server/admin
./psql READWRITE

to accces the RAWDATA database (that also contains edits), use RAWDATA, instead of READWRITE. If you would like to access the DB from outside the virtual box, take a look at [http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html how to change postgres connection settings].

=== Turning the VM into development box ===

If you would like to use the VM to do development instead of using it as a simple database slave, you'll need to edit lib/DBDefs.pm and set REPLICATION_TYPE to RT_STANDALONE and run admin/psql READWRITE and execute the following queries:

DELETE FROM annotation WHERE editor > (SELECT max(id) FROM editor);
DELETE FROM release_annotation WHERE NOT EXISTS (SELECT 1 FROM annotation WHERE annotation.id = release_annotation.annotation);

then from the command line execute:
# run admin/psql READWRITE < admin/sql/CreateFKConstraints.sql
# run admin/psql READWRITE < admin/sql/CreateFunctions.sql

TODO: The server will probably run out of disk space during this process. We need to add instructions on how to move the DB to a new partition.

== Setting up MusicBrainz NGS from source code ==

This can be a very laborious and time consuming method of getting a functioning MusicBrainz server. Using the virtual machine is recommended.
# Get a copy of musicbrainz-server from git: <code>git clone git://git.musicbrainz.org/musicbrainz-server.git musicbrainz-server</code>
# <code>cd musicbrainz-server</code> and follow the instructions in INSTALL

Note that you won't have a search server after running this; since NGS has been released, the default search server will work for you! If you're curious, you can also install and set up your own search server, but that is beyond the scope of this document.

[[Category:Products]] [[Category:Server]] [[Category:WikiDocs Page]]

Latest revision as of 01:36, 11 November 2011