Backup in rails

Hello All,

I am trying to take a bacup of mysql database using rails appliction.

when i am executing the following command using irb i am able to take
the backup

system(“mysqldump -u root -p -h cu-269 testdev > d:/testl.sql”)

but when i am doing the same using a rails application i.e is thru web
i am unable to backup the database.The page is hanging up with out any

My development environment is windows ,is this creating any problem

when i see the taskmanager-processes the mysqldump process is still

while in IRB the mysql process is stoping as soon as the backup
operation is complete

am i missing out some thing that i need to do in rails

Prasad B

On 27 Oct 2007, at 09:37, rails wrote:

am i missing out some thing that i need to do in rails

This is nothing to do with rails and everything to with mysql.To take
a consistent dump with mysqldump you need to lock the db, which stops
any other writes.

-have a master & a slave and take database dumps off the slave
-use something like innodb hot backup (
-use lvm snapshotting.

  • perhaps others - I’m not expert.


This might be off-topic, but… Why would you create a dump of your
database through a web request? Maybe use the request to tell the system
to start a certain rake task, that, for example, dumps, compresses and
packages up with the rest of your files, and places it somewhere ready
to download, maybe behind some authorization system, firing an email at
you when done.

I’d say, it’s a much cleaner approach than maybe having the request
return a gziped dump directly.

Though I’m no ruby-master (pretty much on the other side of the gauge),
so I’d have no clue how to build such a rake task. This is just an
application design theory.


El s�b, 27-10-2007 a las 01:37 -0700, rails escribi�: