Difference between revisions of "Backup and restore"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
 
(3 intermediate revisions by 3 users not shown)
Line 28: Line 28:
The service will call the tsrsyncdump.sh every 24 hours, making a dump ready for remote synchronization.
The service will call the tsrsyncdump.sh every 24 hours, making a dump ready for remote synchronization.


== Windows server backup options ==
== Windows server backup ==


# Create .bat file
# Create .bat file
Line 41: Line 41:


[http://www.tempusserva.dk/articlebase/Secure%20rsync%20from%20Linux%20webservers%20to%20Windows%20backup%20host.pdf Secure rsync from Linux webservers to Windows backup host.pdf]
[http://www.tempusserva.dk/articlebase/Secure%20rsync%20from%20Linux%20webservers%20to%20Windows%20backup%20host.pdf Secure rsync from Linux webservers to Windows backup host.pdf]
== Corrupted databases ==
Try in the following order
# Run the '''mysqlcheck''' tool
# Dump database if possible using '''mysqldump'''
# Connect remotely and dump SQL script files of each table
== Problems with views ==
In some cases database views will be treated as tables which requires them to be deleted
  DROP TABLE IF EXISTS authenticationtype;
  DROP TABLE IF EXISTS cleanuppolicy;
  DROP TABLE IF EXISTS datatypegroup;
  DROP TABLE IF EXISTS datatypegroupsub;
  DROP TABLE IF EXISTS datatypemapping;
  DROP TABLE IF EXISTS defaultsystemconfig;
  DROP TABLE IF EXISTS eventdomain;
  DROP TABLE IF EXISTS eventseverity;
  DROP TABLE IF EXISTS formstatusactiontype;
  DROP TABLE IF EXISTS guilanguage_copy;
  DROP TABLE IF EXISTS guilanguageterm;
  DROP TABLE IF EXISTS guilanguageword_copy;
  DROP TABLE IF EXISTS guistyle_copy;
  DROP TABLE IF EXISTS integrationtype;
  DROP TABLE IF EXISTS messagetype;
  DROP TABLE IF EXISTS persistencescope;
  DROP TABLE IF EXISTS persistencetype;
  DROP TABLE IF EXISTS remotedatabasedriver;
  DROP TABLE IF EXISTS reservednames;
  DROP TABLE IF EXISTS satelitemode;
  DROP TABLE IF EXISTS sharemediatype;
  DROP TABLE IF EXISTS sqllogcrud;
  DROP TABLE IF EXISTS sqllogtarget;
  DROP TABLE IF EXISTS staticdatacountry;
  DROP TABLE IF EXISTS staticdatacountrycode;
  DROP TABLE IF EXISTS staticdatacurrencycode;
  DROP TABLE IF EXISTS staticdatanace;
  DROP TABLE IF EXISTS staticdatapostalcode;
  DROP TABLE IF EXISTS staticdataunspsc;
  DROP TABLE IF EXISTS staticicddiagnose;
  DROP TABLE IF EXISTS staticsksatc;
  DROP TABLE IF EXISTS staticsksbehandling;
  DROP TABLE IF EXISTS staticsksdiagnose;
  DROP TABLE IF EXISTS staticsksoperation;
  DROP TABLE IF EXISTS staticskssygehusafdeling;
  DROP TABLE IF EXISTS staticsksulykke;
  DROP TABLE IF EXISTS staticsksundersoegelse;
  DROP TABLE IF EXISTS statisticsftest;
  DROP TABLE IF EXISTS systemcodeunittype;
  DROP TABLE IF EXISTS systemconfiggroup;
  DROP TABLE IF EXISTS systemconfigvalue;
  DROP TABLE IF EXISTS systemdatatype;
  DROP TABLE IF EXISTS systemdatatypegroups;
  DROP TABLE IF EXISTS systemdatatypepackage;
  DROP TABLE IF EXISTS systemformat;
  DROP TABLE IF EXISTS systemhelp;
  DROP TABLE IF EXISTS systemindicatorview;
  DROP TABLE IF EXISTS systemmodelvariabletype;
  DROP TABLE IF EXISTS systemnamedquerys;
  DROP TABLE IF EXISTS systemoperator;
  DROP TABLE IF EXISTS systempolicygroup;
  DROP TABLE IF EXISTS systempolicymeta;
  DROP TABLE IF EXISTS systemsamplevalue;
  DROP TABLE IF EXISTS systemstate;
  DROP TABLE IF EXISTS userflagtype;
  DROP TABLE IF EXISTS usermenulayout;
  DROP TABLE IF EXISTS usermenulevel;
  DROP TABLE IF EXISTS version;
  DROP TABLE IF EXISTS widgetlayout;
  DROP TABLE IF EXISTS widgetposition;
  DROP TABLE IF EXISTS widgettype;

Latest revision as of 13:57, 30 April 2024

Everything in a TempusServa installation is stored in the underlying database.

A full backup plan will only require frequent snapshots of the database.

The only exception to the all-in-the-database policy is

  • Connection string for the database
  • Container ressources such as SSL certficates

Depending on the amount of data stored in the database, we usually recommend using af differencial backup.

Note: The database should allways be stopped during backups, to ensure integrity of a filesystem backup.

UNIX server tools

Using the Command line tools you can set up a RSYNC differntial backup easily.

Procedure for a Windows backup server

  1. Tempus Serva Server:
    1. Run tsrsyncdump.sh (test run)
    2. Run tsinstallcronjobs.sh (future scheduled runs)
  2. Windows backup machine:
    1. Install Cygwin tools: http://www.cygwin.com/
    2. Edit the serverBackup.sh to fit your environment
    3. Run serverBackup.bat (test run)
    4. Create a scheduled job pointing to serverBackup.bat file (future scheduled runs)

The service will call the tsrsyncdump.sh every 24 hours, making a dump ready for remote synchronization.

Windows server backup

  1. Create .bat file
    1. Use mysqldump to backup all of the databases
    2. Copy files to safe location (network drive etc.)
  2. Execute above file scheduled from the Windows task manager

Configuring the mysqldump i straitfroward using the MySQL documentation and examples

Backup synchronization (Linux server to Windows storage)

The following article describes incremental backup files can be transferred from a Linux server to a Windows client

Secure rsync from Linux webservers to Windows backup host.pdf

Corrupted databases

Try in the following order

  1. Run the mysqlcheck tool
  2. Dump database if possible using mysqldump
  3. Connect remotely and dump SQL script files of each table


Problems with views

In some cases database views will be treated as tables which requires them to be deleted

 DROP TABLE IF EXISTS authenticationtype;
 DROP TABLE IF EXISTS cleanuppolicy;
 DROP TABLE IF EXISTS datatypegroup;
 DROP TABLE IF EXISTS datatypegroupsub;
 DROP TABLE IF EXISTS datatypemapping;
 DROP TABLE IF EXISTS defaultsystemconfig;
 DROP TABLE IF EXISTS eventdomain;
 DROP TABLE IF EXISTS eventseverity;
 DROP TABLE IF EXISTS formstatusactiontype;
 DROP TABLE IF EXISTS guilanguage_copy;
 DROP TABLE IF EXISTS guilanguageterm;
 DROP TABLE IF EXISTS guilanguageword_copy;
 DROP TABLE IF EXISTS guistyle_copy;
 DROP TABLE IF EXISTS integrationtype;
 DROP TABLE IF EXISTS messagetype;
 DROP TABLE IF EXISTS persistencescope;
 DROP TABLE IF EXISTS persistencetype;
 DROP TABLE IF EXISTS remotedatabasedriver;
 DROP TABLE IF EXISTS reservednames;
 DROP TABLE IF EXISTS satelitemode;
 DROP TABLE IF EXISTS sharemediatype;
 DROP TABLE IF EXISTS sqllogcrud;
 DROP TABLE IF EXISTS sqllogtarget;
 DROP TABLE IF EXISTS staticdatacountry;
 DROP TABLE IF EXISTS staticdatacountrycode;
 DROP TABLE IF EXISTS staticdatacurrencycode;
 DROP TABLE IF EXISTS staticdatanace;
 DROP TABLE IF EXISTS staticdatapostalcode;
 DROP TABLE IF EXISTS staticdataunspsc;
 DROP TABLE IF EXISTS staticicddiagnose;
 DROP TABLE IF EXISTS staticsksatc;
 DROP TABLE IF EXISTS staticsksbehandling;
 DROP TABLE IF EXISTS staticsksdiagnose;
 DROP TABLE IF EXISTS staticsksoperation;
 DROP TABLE IF EXISTS staticskssygehusafdeling;
 DROP TABLE IF EXISTS staticsksulykke;
 DROP TABLE IF EXISTS staticsksundersoegelse;
 DROP TABLE IF EXISTS statisticsftest;
 DROP TABLE IF EXISTS systemcodeunittype;
 DROP TABLE IF EXISTS systemconfiggroup;
 DROP TABLE IF EXISTS systemconfigvalue;
 DROP TABLE IF EXISTS systemdatatype;
 DROP TABLE IF EXISTS systemdatatypegroups;
 DROP TABLE IF EXISTS systemdatatypepackage;
 DROP TABLE IF EXISTS systemformat;
 DROP TABLE IF EXISTS systemhelp;
 DROP TABLE IF EXISTS systemindicatorview;
 DROP TABLE IF EXISTS systemmodelvariabletype;
 DROP TABLE IF EXISTS systemnamedquerys;
 DROP TABLE IF EXISTS systemoperator;
 DROP TABLE IF EXISTS systempolicygroup;
 DROP TABLE IF EXISTS systempolicymeta;
 DROP TABLE IF EXISTS systemsamplevalue;
 DROP TABLE IF EXISTS systemstate;
 DROP TABLE IF EXISTS userflagtype;
 DROP TABLE IF EXISTS usermenulayout;
 DROP TABLE IF EXISTS usermenulevel;
 DROP TABLE IF EXISTS version;
 DROP TABLE IF EXISTS widgetlayout;
 DROP TABLE IF EXISTS widgetposition;
 DROP TABLE IF EXISTS widgettype;