| 
 Fastbase Accounting System - Online Manual Remote Backup for Clients  | 
Document 106649/1 
Entered Tue, 20 Feb 2007 09:41 by Peter Campbell 
Updated Wed, 19 Sep 2007 09:54 
Previous
  | 
 
This document explains how to establish a backup of a clients database on our web server and configure the web server for automatic backups on a daily basis. 
 
Details: 
 
Log into the clients system and grab a backup of all mysql data files from the BACKUP folder (usually C:\FBASE\BACKUP). Use winzip to create a zip file database_name.zip 
"pscp" the database zip file back to our server (eg: pscp database_name.zip fastbase@fastbase.co.nz:database_name.zip). 
 
Explore the C:\MYSQL\DATA folder and note down the name of the mysql binary log files. Also note down the number of the second to last file (not the one currently open). eg: servername-bin.000005 
 
Alternatively check the timestamp of the most recently modified database backup file, and note the number of the binlog file with the same timestamp. 
 
When setting up a backup for the first time, update the setup.dat file at the clients site with the mysql binary log name: set setup(mysql_logs) "c:/address/to/servername-bin" (all except the .NNNN). Then restart fbserver. 
 
Now log into our webserver (fastbase.co.nz). 
Change to the root user (su). 
Change to the mysql data folder: 
->  cd /data/mysql 
For a new client, make a new directory (same as the clients database name - exactly): 
->  mkdir database_name 
Modify the file owner: 
->  chown mysql:mysql database_name 
Change to the new directory:  
->  cd database_name 
Unzip the files: 
->  unzip /home/fastbase/database_name.zip 
Modify the files owner #1: 
->  chown mysql:mysql * 
Modify the files access #2:  
->  chmod 660 * 
Check case sensitive file extensions:  
->  tclsh /home/fastbase/new/zerofile.tcl 
Start mysql and create a special table for fastbase: 
->mysql database_name 
Create a new table 
> CREATE TABLE WEB_LOG (LAST_LOG INT); 
Update this table with the last log number (from the clients server above). 
> INSERT INTO WEB_LOG values (5); 
Exit mysql 
> quit 
Refresh the database cache from the new files 
> mysqladmin refresh 
Exit the root user: 
->  exit 
 
For a new client, create a schedule (cron) to automatically update the database daily. 
(you will still be logged into fastbase.co.nz, as fastbase). 
Change to the scripts directory: 
->  cd /home/fastbase/scripts 
Create a .dat file for the client (take another clients file), eg: 
->  cp asi.dat database_name.dat 
Edit the file with "vi". Update the host and database details. 
-> vi database_name.dat 
Create a schedule (cron) entry as follows: 
->  crontab -e 
Make another entry, use another client as example (eg: asi). Set a different hour and/or time, typically around 4:00-5:00am. 
 
This should now be complete: 
 
To manually run the update (get the binlogs from the client site) do the following; 
 
Log into fastbase.co.nz (as fastbase). 
Change to the scripts directory: 
->  cd scripts 
Run the file: 
->  tclsh binlogs1.tcl database_name.dat 
This might take a few minutes. The results should get emailed to support@fastbase.co.nz 
  |