Results 1 to 5 of 5
Hello,
I'm new to these forums so I hope I haven't forgotten anything.
I've got a Centos 5 machine running with a raid 1 SSD hard drive combo, as I ...
- 08-08-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 5
Pipe mysql dump to FTP without writing to disk
Hello,
I'm new to these forums so I hope I haven't forgotten anything.
I've got a Centos 5 machine running with a raid 1 SSD hard drive combo, as I don't know how or even if it's possible yet to wipe the free disk space clean I need to be careful to not fill all the free disk space.
As I don't want to fill the free disk space too quickly and was wandering if it is possible to pipe the result of a mysqldump to a FTP client only writing it to the ram and not writing it to this disk.
I've done a bit of research on the subject and have found the two following commands :
Code:mysqldump < mysqldump options> | gzip > outputfile.sql.gz
I would like to combine the two to make something like this :Code:tar cf - / | ncftpput -c sonic.sega.co.jp /usr/local/backup.tar
I haven't actually tried my code as it seems too easy and I'm sure I've got something wrong ! If this command is even correct will it prevent the sql file from being written to the hard drive to my local machine ?Code:mysqldump mysqldump_options > | ncftpput ncftpput_options -c SERVER_IP backup.sql
Thank you.
- 08-08-2010 #2
This is not possible with ftp, as it lacks streaming support.
Meaning:
You can only upload/download files as a whole, but not work within files.
Protocols allowing this would be cifs or nfs, both shall only be used in *your* network.
aka in a controlled environment.You must always face the curtain with a bow.
- 08-08-2010 #3Just Joined!
- Join Date
- Aug 2010
- Posts
- 5
Thankyou,
Doesn'tinvolve steaming ? Because I got it from the ncftp docs… from what I understood ncftpput could sort of wait for the whole file to arrive before sending it …Code:tar cf - / | ncftpput -c sonic.sega.co.jp /usr/local/backup.tar
Is there not a way to put the whole SQL dump to the ram and send it to FTP without writing it to the hard disk ?
- 08-08-2010 #4
You might be right, and I am surprised to see that option in the man page.
Now, if ncftpput would not use a tmp file then it might be exactly what you want.
Just try it
mysqldump mysqldump_options | ncftpput ncftpput_options -c SERVER_IP backup.sql
Note that ">" is left out.
While this is running, check what it is doing:
lsof|grep ncftpput
and look for tmp filesYou must always face the curtain with a bow.
- 08-08-2010 #5Just Joined!
- Join Date
- Aug 2010
- Posts
- 5
Thanks I'll give it a go tomorrow !
I left the > for mysqldump because of the mysql commands being
to export andCode:mysql database > file.sql
to import, so I presumed that it was necessary to keep the arrow to make sure that it did the right thing.Code:mysql database < file.sql
I've just comme across this :
astbss.org/mysqldump-to-a-remote-server
Seems possible to dump a database via ssh using cat…
Using the following command :Code:mysqldump [mysqldump options] | gzip -c | ssh user@remotehost "cat > /path/to/some-file.sql.gz"


Reply With Quote