MySource Matrix Resources

MySource Matrix has been superseded by Squiz Matrix. This site will remain available for archival purposes only; it is not intended as a current source of Matrix information. For all the latest on Matrix, including documentation and release information, visit the Squiz Matrix site.

Main Content

MySource Matrix Backup Management Guide

Introduction

This guide will show you how to backup and restore your MySource Matrix system. This guide requires you to have shell access to the MySource Matrix application server to run the backup script and database queries.

Creating a Backup File

If you do not have regular backups of your application and database servers, it is a good idea to use the MySource Matrix backup script to create backups of your MySource Matrix system. Backups should also be taken before attempting any upgrade, or whenever you're feeling nervous!

MySource Matrix comes with a backup script that creates a tar archive of the MySource Matrix source code, database and file system data.

Note that this procedure can take a long time if you have a lot of content in your MySource Matrix system.

For MySource Matrix 3.20.0 systems and later
$ cd /path/to/matrix
$ ./scripts/backup.sh /path/to/matrix
For systems prior to MySource Matrix 3.20.0
$ cd /path/to/matrix
$ ./scripts/backup.sh

By default, the MySource Matrix backup script will create a file based on the current date and time in the MySource Matrix root directory. You can choose a directory other than the default if you need to.

For example, the following commands will backup your MySource Matrix installation to the /home/backups directory. An alternate filename, rather than just a directory name, can be specified when backing up systems prior to MySource Matrix 3.20.0.

For MySource Matrix 3.20.0 systems and later
$ cd /path/to/matrix
$ ./scripts/backup.sh /path/to/matrix /home/backups
For systems prior to MySource Matrix 3.20.0
$ cd /path/to/matrix
$ ./scripts/backup.sh /home/backups/mynewbackup.tar
Specifying a Remote Database for Oracle

If your MySource Matrix system uses an Oracle database located on a separate server, the script must ssh to the database server and retrieve it. This is not required for PostgreSQL based systems.

The script will connect to the server, dump the database, and copy the resulting file back to the machine the script is being run from.

For MySource Matrix 3.20.0 systems and later
Backup to the Matrix System Root directory:
$ ./scripts/backup.sh /path/to/matrix --remotedb=user@db.example.com
Or backup to a specified directory:
$ ./scripts/backup.sh /path/to/matrix /path/to/backup/folder --remotedb=user@db.example.com
For systems prior to MySource Matrix 3.20.0
$ ./scripts/backup.sh --remotedb=user@db.example.com

Please note that the user you connect as must have exp in their path for the database dump to work correctly.

Restoring From a Backup File

If you need to restore your system from a backup, you will need to remove your existing system and recreate it from the backup file.

This guide will show you how to restore a MySource Matrix system from a backup file, assuming the system is installed as /home/websites/mysource_matrix and the backup file is located at /home/backups/mybackup.tar.gz.

Restoring from backup will remove your existing system, including all existing file system and database data. You should consider backing-up your running MySource Matrix system before replacing it with an older backup to ensure no data is lost.

Restoring the File System

The following commands will delete your existing MySource Matrix source files and file system data and replace them with the backed -up copies.

$ cd /home/websites
$ rm -rf mysource_matrix
$ mkdir mysource_matrix
$ cd mysource_matrix
$ cp /home/backups/mybackup.tar.gz .
$ tar -zxvf mybackup.tar.gz
Restoring the Database

The extraction of the backup file will have created a file with a .dump extension. This is the dump of your MySource Matrix database. Depending on the type of database you use, Postgres or Oracle, the command for restoring the database is different.

Restoring a PostgreSQL Database

The following commands will restore your existing MySource Matrix database, assuming your database is called mysource_matrix.

$ dropdb -U postgres mysource_matrix
$ createdb -U postgres -O username -E SQL_ASCII mysource_matrix
$ psql -f dumpfile.dump mysource_matrix

where username is the user MySource Matrix uses to connect to its database and dumpfile.dump is the name of the database dump file that was extracted from the backup archive.

Restoring an Oracle Database

The following commands will restore your existing MySource Matrix database.

$ imp username/password@SID file=dumpfile.dump

where SID is the session id and dumpfile.dump is the name of the database dump file that was extracted from the backup archive.