Thursday, February 3, 2011

How can I backup a website? (Unix server)

Does a website using a database, need to be shut down when a backup is being made? (assuming you are not using replication)?

[Edit]

Apologies about the brevity of the question. I have provided more details below:

  • OS: Ubuntu Lucid Lynx (10.04 LTS)
  • web application framework: Symfony (PHP web framework)
  • databases: mysql (v5.1) AND postgresql (v 8.4)

Additional files that need to be backed up:

  1. configuration files (php.ini, httpd.conf etc)
  2. data files in specific folders
  3. cron jobs (bash scripts, PHP scripts, Python scripts, Ruby scripts)

more specific information that may be relevant:

I am running the site on a private virtual server (so I have root access), on a machine hosted on Linode.

  • It depends on your database. Mysql has possibilities to do hot dumps if you use the right database engine.

    From txwikinger
  • Use mysqldump to back up the mySQL database.

    Use pg_dumpall to back up the postgres database.

    Use rsync to back up the website files.

    You don't need to shutdown the database whilst making the back-up, though depending on the underlying engine used, tables may be locked whilst the dump is running.

    churnd : A good script that uses mysqldump: AutoMySQLBackup, http://sourceforge.net/projects/automysqlbackup/
    From Pete

0 comments:

Post a Comment