Setting Up A Star Offline Database Mirror
Set up an environment consistent with the STAR db environments.
- Create a user named 'mysql' and a group 'mysql' on the system.
- Create a directory for the mysql installation and data. The standard directory for STAR offline is /db01/offline
- In /db01/offline place the tarball of mysql version 5.0.51a (or greater) downloaded from here.
- Untar/zip it. Use "--owner mysql" in the tar command, or recursively chown the untarred directory so that mysql is the owner (eg. 'chown mysql:mysql mysql-5.0.51a-linux-i686-glibc23'). Delete the tarball if desired.
- Still in /db01/offline, create a soft link named 'mysql' that points to the mysql directory created by the untar (ln -s mysql-5.0.51a-linux-i686-glibc23 mysql'). /db01/offline should now have two items: mysql (a link), and mysql-standard-5.0.51a-linux-i686-glibc23.
- Create a directory /var/run/mysqld and set the owner to mysql, with 770 permissions. (This may be avoideable with a simple change to the my.cnf file (to be verified). If this change is made to the "official" my.cnf, then this step should be removed.)
Next, acquire a recent snapshot of the offline tables and a my.cnf file
There will be two files that need to be transfered to your server; a tarball of the offline database files (plus a handful of other files, some of which are discussed below) and a my.cnf file.
If you have access to RCF, a recent tar of the offline databases can be found here: /star/data07/db/offline_08xxxxx.tar.gz. Un-tar/zip the tarball (with "--owner mysql") in /db01/offline on your server to get a 'data' directory. (/db01/offline/data).
The my.cnf file can be found in /star/data07/db/my.cnf, and should be put in /etc/my.cnf. Before your server is started, either the master information should be commented out, or the server-id should be adjusted to avoid clashing with an existing production slave. Contact Dmitry Arkhipkin to determine an appropriate server-id.
Start the server
At this point you should be able to start the mysql server process. It should be as simple as the following command:
cd /db01/offline/mysql && ./bin/mysqld_safe --user=mysql &
The data directory
The databases
You will now find a complete snapshot of STARs offline data. We use MYSQLs MYISAM storage engine which stores its tables in three files under a directory that is the database name. For example, for database Calibrations_ftpc you will see a directory of the same name. If you descend into that directory you will see three files for each table name. The files are MYD which contain the data, MYI which contain the indexes and FRM which describes the table structure.
Other files
- master.info - This files contains information about the slaves master (aptly named). This includes who the master is, how to connect, and what was the last bit of data passed from the master to the slave. This is stored as an integer in this file.
- You will also find log files, bin files and their associated index files.