Re: Re : Backing up mysql driven website on REMOTE SERVER with SSH
From: Annonymous (nomail_at_nodomain.org)
Date: 12/09/04
- Next message: Kai Schaetzl: "Re: upgrading 8.1 to 9.0 fails in several scenarios"
- Previous message: baskitcaise: "Re: system info tool. What was the name again?"
- In reply to: NeilPaton: "Re : Backing up mysql driven website on REMOTE SERVER with SSH"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 09 Dec 2004 10:18:21 -0500
NeilPaton wrote:
> Can anyone give me general and then specific advice for backing up a
> website on a remote server. I have root access via SSH. So far...
>
> I can log on to ssh rootserver@...
>
> I can then change directory using the cd command,
> I think the syntax is :
>
> cd /home/httpd
>
> That is about all I know at this stage. For doing this.
> I just want to be able to write the website on the remote server (my own
> server) to a local linux PC.
>
> Neil Paton
>
Neil, I run many web sites which use MySQL as their engines. Once you log into
the server via ssh, you will need to "dump" all databases associated with the
web site. This assumes you have access to the databases and MySQL tools.
From your home directory make a directory for your backup
mkdir webbackup
then change to that directory with
cd webbackup
now dump the databases to ascii files with
mysqldump --add-drop-table databasename >databasebackup.dmp
(be sure to include the --add-drop-table to prevent errors if/when you restore)
that step is repeated for any databases your web site uses, of course changing
the file name you are dumping to.
If you are moving the dumped ascii files off to a server over the Internet you
would want to compress them with gzip or take all the dumped files in your
webbackup directory and put them into a compressed tarball with the command
tar -zcvf webbackup.tar *.dmp
Someone else suggested using rsync. I don't know how well that would work with
live databases. I do use rsync with other files. There is an excellent how-to
on using rsync via cron to copy files with SSH public keys at this URL:
http://www.jdmz.net/ssh/
If you're copying the files from the remote server to a local one you should
verify the integrity of your efforts. Untar the files to a webrestore directory
on your local machine
cd webrestore
tar -zxvf webbackup.tar
mysql -e "create database databasename"
mysql -e "grant all privileges on databasename.* to username@localhost
identified by 'password_if_you_use_one'"
mysql -e "flush privileges"
mysql databasename <databasebackup.dmp
The first 3 mysql -e commands are only done once to create the database. The
last mysql piping the data in from dababasebackup.dmp would be done any time you
want to restore the data.
Backing up the database is part of the effort, you have to make sure you back up
your graphics (pictures, icons etc) and any documents or PDFs you have available
on the web site. This is where rsync shines.
Hope this helps.
- Next message: Kai Schaetzl: "Re: upgrading 8.1 to 9.0 fails in several scenarios"
- Previous message: baskitcaise: "Re: system info tool. What was the name again?"
- In reply to: NeilPaton: "Re : Backing up mysql driven website on REMOTE SERVER with SSH"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|