Difference between revisions of "Coral: dbbackup detail"

From The Uniform Server Wiki
Jump to navigation Jump to search
(Created page with "<div id="top" style="margin:0;padding: 0px 0px 0px 5px; color: #000; background-color: #FFFFEB; border: 1px solid darkslateblue;"><span id="top" style="margin:0;padding: 0px;font...")
 
(No difference)

Latest revision as of 13:50, 12 November 2011

Db Backup - Detail

The Uniform Server's database backup allows for either manual or periodic backups. Each database is extracted from the MySQL server in SQL format. The archive files consist of a database name with a unix time stamp appended. For example fred_1306863938_.sql. These are saved to folder UniServer\db_backup (created automatically).

Archive files can become large (they eat disk space). To minimise this, the archive folder implements a FIFO (first in first out) deletion. The total number of files for each database is user specifiable (default 3). On reaching this value the eldest file is deleted to make way for a new archive file.

The above applies to both manual and automatic updates (Using Cron).


UniServer 8-Coral
  Home
  Quick Start
  General
  Apache
  MySQL
  PHP
  MSMTP
  CRON
  DtDNS
» Db Backup
  Perl
  Main Index

Edit DB Backup Config

Uniform Server DB Backup is configured via a configuration file db_backup.ini. This has been pre-configured sets the FIFO depth to 3 and enables logging by default.

You can open this configuration file in one of two ways either using UniController or directely.

UniController: Open file as follows:

Server Configuration > DB Backup > Edit DB Backup Config


Alternatively open the file directly.
Directly: Open the following file in notepad or other suitable text editor: UniServer\uni_con\db_backup\db_backup.ini


Configuration

Fifo_depth = 3

  

This defines total number of archives to save.
When the limit is reached, the eldest archive is deleted to make way for a new archive.
FIFO stands for first-in, first-out (deleted).

Logging = True

  

True enable logging
False Disable logging

;#######################

[FIFO]
Fifo_depth = 3

[LOG]
Logging = true

;=== END Config ========

Note: FIFO size is a compromise between database size, disk space and how often backups are required. Three is just a test value and should be changed to suit your particular requirements.

Top

Force DB Backup

You can force a database backup either using UniController or directly by running the batch file Run_db_backup.bat. Either method assumes you have entered databases to the file list see section to be backed up.

UniController:

Server Configuration > DB Backup > Force DB Backup

Directely:

UniServer\uni_con\db_backup\Run_db_backup.bat

Top

Enable log

This menu option is identical to "Edit DB Backup Config". It allows you to enable or disable logging.

Server Configuration > DB Backup > Enable log

  • Logging = True - Enable logging
  • Logging = False - Disable logging
;#######################

[FIFO]
Fifo_depth = 3

[LOG]
Logging = true

;=== END Config ========

Top

View Log

Server Configuration > DB Backup > View Log

The log file opens in Notepad; an extract from this file is shown on the right.

Log file displays date and time a database was backed up. Each file has a time stamp appended to its file name.

Note: The log file provides a quick way to check databases are being backed up. This is useful when setting up configuration files such as Cron.

19/07/2011 22:18:07 ### Log Started ===========================
19/07/2011 22:18:07  File backed up - wordpress_1311081487_.sql
19/07/2011 22:18:07  File backed up - joomla_1311081487_.sql
19/07/2011 22:18:07 ### Log Ended =============================

19/07/2011 22:22:37 ### Log Started ===========================
19/07/2011 22:22:37  File backed up - wordpress_1311081757_.sql
19/07/2011 22:22:37  File backed up - joomla_1311081757_.sql
19/07/2011 22:22:37 ### Log Ended =============================

19/07/2011 22:25:30 ### Log Started ===========================
19/07/2011 22:25:30  File backed up - wordpress_1311081930_.sql
19/07/2011 22:25:30  File backed up - joomla_1311081930_.sql
19/07/2011 22:25:30 ### Log Ended =============================

Note: The Log file location UniServer\uni_con\db_backup\db_backup.log

Top

Enable In Cron

Every time you want to create a backup you need to manually run Force DB Backup.

Remembering to manually run scripts like Force DB Backup becomes a chore. Uniform Server centralises running this type of script using portable Cron. Cron is started either manually (portable) or run as a service. It periodically executes a list of scripts; the "Force DB Backup" script is included and requires enabling as follows:

You can open Cron configuration file in one of two ways either using UniController or directely.

UniController: Open file as follows:

Server Configuration > DB Backup > Enable In Cron

Directly: Open the following file in notepad or other suitable text editor:
UniServer\uni_con\cron\cron.ini


Configuration:

  • Locate the section shown on right
;[db_backup]
;start  = 2009-09-21 2:56:52
;period = hourly
;path   = C:\UniServer\uni_con\db_backup\Run_db_backup.bat
;ref =

Enable the pre-configured db_backup section in Cron as follows:

  • Un-comment the four lines as shown on right.
;[db_backup]
start  = 2009-09-21 2:56:52
period = hourly
path   = C:\UniServer\uni_con\db_backup\Run_db_backup.bat
ref =

Note: You can change the start time and period to suit your own requirements. See Cron Configuration file for details.

Top

Select DBs to backup

In order to backup a database it must be added to the backup list contained in a file. This menu option provides an easy to use interface for adding or removing databases to and from this list. All users MySQL databases are listed on the left (1). The list of databases to be backed up is shown on the right (4) these are the current entries saved in a file.

Server Configuration > DB Backup > Select DBs to backup

Add to file

  • From the databases listed on the left select a database to backup (1).
  • Click the Add button (2).
    Selected database appears in right window (4) and added to file.

Note: Clear button (3) deselects a selection

Remove from file

  • To delete an entry select a database from the list (4)
  • Click Delete button (5). Removes entry from list and file.

Coral dbbackup add del database.gif

Direct Alternative:

An alternative to using the above menu item is to directly edit the database list file. Open the following file in a text editor:


UniServer\uni_con\db_backup\dbs_to_backup.txt


Add or delete database names as required.

Note: The following files should not be included in the backup list: "information_schema", "mysql", "performance_schema" or "phpmyadmin".

Top

Restore DBs from backup

This menu option allows you to restore a database from a backup file.
All files backed up are displayed in section (1) each file listed has a time stamp appended.

Note: Smaller number indicates older backup.

Server Configuration > DB Backup > Restore DBs from backup

Restore database

  • From the list (1)Select a database to restore.
  • Click Restore button (2)

Coral dbbackup restore database.gif

Note: Backup files are saved to folder UniServer\db_backup.

Top