Omzy Posted January 28, 2010 Share Posted January 28, 2010 I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server. The way I want to achieve this is as follows: 1) I will have a page on my localhost server with a form that submits to a script on the live server 2) The script on the live server receives the request and beings to generate the dump data 3) Once generated it sends back this data to a script on my localhost server 4) The script on my localhost server receives the data and runs the queries What methods can be used to achieve this? I know possibly the easiest method would be to just POST the data in a hidden form variable, but I'm not too convinced this is secure. I've heard I can use XML as an alternative option, but not too sure about this. Anyone got any suggestions? Quote Link to comment Share on other sites More sharing options...
Omzy Posted January 28, 2010 Author Share Posted January 28, 2010 Anyone able to advise? Thanks. Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 28, 2010 Share Posted January 28, 2010 How about: 1. Create a cron job on your server that runs mysqldump periodically. 2. Create a cron job/schduler event that logs to your server through FTP and downloads latest dump. Quote Link to comment Share on other sites More sharing options...
Omzy Posted January 29, 2010 Author Share Posted January 29, 2010 Any other suggestions? Quote Link to comment Share on other sites More sharing options...
citricsquid Posted January 29, 2010 Share Posted January 29, 2010 My method is slightly more complicated, but a lot more secure. You'll need a script for generating the dump, a script for activating the backup and a script for receiving the backup (listen). 1. user loads up the form page and clicks submit (or whatever you want them to do to trigger it) 2. The live server starts to generate a backup 3. once the backup is generated the live server sends the backup to the "listen" script on your backup server 4. The listen script then runs the query. For example: website1.com/form.php -> user clicks "generate backup" -> request sent to "website2.com/dump.php" -> website2.com/dump.php generates a sql dump -> website2.com/dump.php sends the dump to website1.com/listen.php -> website1.com/listen.php runs the query. This means the user will never see the data, it'll all be transfered behind the scenes. Apologies if I explained it poorly, this is a graphic created by Paypal that shows how I mean: https://cms.paypal.com/cms_content/US/en_US/images/developer/IPNOverview.gif Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 29, 2010 Share Posted January 29, 2010 Just remember backing up of a whole SQL database may hang your site, depending on the amount of records and the internet throughput/IO bandwidth. Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 29, 2010 Share Posted January 29, 2010 This means the user will never see the data, it'll all be transfered behind the scenes. ok... Why not run a replication then? I understood it was for backup purposes only, not to tranfer data between websites. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.