Changes

Jump to navigation Jump to search

5.3-Nano: Database Backup

106 bytes added, 12:10, 25 January 2010
Minor grammar changes, and some rewriting for clarity
'''Uniform Server and Database Backup'''
Uniform Servers Server's database backup allows for either manual or periodic backups. Each database is extracted from the MySQL server in SQL format and compressed using 7z these . These are then archived into a single file (7z).
Archive files consist of a base name (changeable) with a time stamp appended. These are saved to folder UniServer\db_backup\archive (automatically created).
Archive files can become large hence (they eat disk space). To minimise this, the archive folder implements a FIFO (first in first out) deletion. The total number of files is user specified. 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.
<pre>
Fifo = 6 ; How many archive files to save.
Archive_name = dbs_ ; Archive name (a timesramp timestamp will be added)
Excludes[] = information_schema ; Do not remove
</pre>
{|
|-
|Fifo = 6||This defines total number of archives to save. When limit is reached , eldest archive is deleted to
make way for a new archive. Fifo stands for first in first out (deleted)
|-
| Archive_name = dbs||This is part a prefix of an archive’s name. A timestamp is added ; for example: dbs_2009-09-26-18-56-32.7z
|-
|Excludes[] = db_name|| If you wish to exclude databases from being backed up , add each one to the list with format shown.
The fist in this list is '''information_schema''' it . It is a built-in virtual database which cannot be archived hence , so it is excluded.
Example: To exludes exclude databases fred123 and books. List as follows:
{|
|-
|}
|}
'''''NoteNotes'':'''
Fifo size is a compromise between database size, disk space and how often backups are required.
Six was only a test value hence it needs changing and should be changed to suit your particular requirements.
'''''[[#top | Top]]'''''
=== Manual Update ===
You can run the following batch file to manually force a backup,:
Batch file: UniServer\plugins\db_backup\'''Run_db_backup.bat'''
=== Cron - Automatic backups ===
Cron provides a periodic tick to automtically automatically run scripts. The database backup script has been pre-configured in Cron , however it is disabled by default.
To enable db_backup , edit file UniServer\unicon\main\'''cron.ini'''
Locate the db_backup block:
</pre>
|}
Optionally change The current time will be used as the start time. If unless you do not change this it to a future time. Since the current start time will be used. When in the example has passed, when Cron is initially run started, db_backup will run immediately and run thereafter runs every hourthereafter.
You can change the period to suit your specific requirements.
'''''Note'':'''
You need to start Cron either manually or automatically refer . Refer to [[5.3-Nano: Portable Cron | '''Cron page''' ]]for details.
'''''[[#top | Top]]'''''
Logging is enabled by default. Log file: UniServer\db_backup\db_backup.log
Disable To disable/enable logging , edit file: UniServer\plugins\db_backup\'''db_backup.php'''
Change the following line as required:
Background 7z was chosen because of its impressive compression and provides a 7-Zip Standalone Console application 7za.exe.
Of real importance is it is fully portable.
To extract archive files you require 7-Zip Portable this . This can be found on [http://portableapps.com/ PortableApps website]
Download 7-Zip Portable from the following page:
(http://portableapps.com/apps/utilities/7-zip_portable)
The advantage of using 7-Zip Portable is it allows you to view the archive content and to extract a single database if you wish.
== Warning ==
To ensure that archived data can be retrieved and installed , always perform several test runs. Create a duplicate server and check that backups from the prime server can be installed on this server.
You don’t want any unexpected surprises when a backup becomes essential.
'''''[[#top | Top]]'''''
== Summary ==
The script is not written it stone hence , so change it as requiredyou require.
[[5.3-Nano: msmtp | '''Next page''']] covers configuring msmtp , an SMTP client now integrated into Uniform Server.
'''''[[#top | Top]]'''''

Navigation menu