Documentation

Difference between revisions of "Making Backups"

(PostgreSQL command line)
(A backup of your files)
Line 2: Line 2:
  
 
== A backup of your files ==
 
== A backup of your files ==
You can use the graphical methods described in [[Accessing your files]] to download a copy of all of your files. This copy, or certain files, can then easily be uploaded again using the same method to restore backups
+
You can use the methods described in [[Accessing your files]] to download a copy of all of your files or specific folders you will be working on. If something goes wrong, you can easily restore files to a previous state by re-uploading those you have downloaded and saved.
  
 
== A backup of your databases ==
 
== A backup of your databases ==

Revision as of 12:36, 3 November 2019

ULYSSIS takes backups of all files, databases, settings and repositories 1-4 times a week. These backups can be restored in case of severe server failure or in case of an emergency (if for example a user by mistake deletes all of their site). It is, however, more convenient that users take their own backups when they do experimental things on their account.

A backup of your files

You can use the methods described in Accessing your files to download a copy of all of your files or specific folders you will be working on. If something goes wrong, you can easily restore files to a previous state by re-uploading those you have downloaded and saved.

A backup of your databases

To take a backup of your database you simple use the export function of PHPMyAdmin, PHPPgAdmin and/or Adminer as described on Using PHPMyAdmin, Using PHPPgAdmin and Using Adminer.

If you are backing up and/or restoring a larger database, it's advised to use command line tools since they are more performant than webtools and don't have any timeouts that could interrupt your backup/restore.

MySQL command line

To take a backup, execute the following command on one of our shellservers (with the right database name filled in):

mysqldump -h mysql.ulyssis.org -p username_database > backup.sql

This will prompt you for your database password (please refer to Using MySQL if you don't know your password) and then dump the entire database to backup.sql file as SQL.

To restore your backup you can use the mysql command on one of our shellservers (with the right database name filled in), whatever SQL file you specify will be executed:

mysql -h mysql.ulyssis.org -p username_database < backup.sql

Please keep in mind that by default mysqldump includes statements in the SQL file that will delete all tables that will be restored.

If you wish to have more control over different settings when taking or restoring please, you can refer to the respective man pages of mysqldump and mysql using man mysqldump and man mysql

PostgreSQL command line

To take a backup, execute the following command on one of our shellservers (with the right database name filled in):

pg_dump -h pgsql.ulyssis.org -W --clean username_database > backup.sql

This will prompt you for your database password (please refer to Using PostgreSQL if you don't know your password) and then dump the entire database to backup.sql file as SQL with COPY statements. If you prefer INSERT instead of COPY statements, you can add --inserts to your command.

To restore your backup you can use the pg_restore command on one of our shellservers (with the right database name filled in), whatever SQL file you specify will be executed:

psql -h pgsql.ulyssis.org -W username_database < backup.sql

Please keep in mind that because we specified --clean earlier, our SQL file includes statements that will delete all tables, sequences, functions and schemas that will be restored.

If you wish to have more control over different settings when taking or restoring please, you can refer to the respective man pages of pg_dump and psql using man pg_dump and man psql