Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
June 30, 2008 - Submit Your Site for the July 08 Site of the Month Award!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 25, 2008, 06:21:38 PM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: MySQL Backups on VPS  (Read 1621 times)
hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« on: March 04, 2008, 07:51:00 AM »

I'm currently moving from basic hosting to VPS, and trying to research whatever I will need to know about VPS....got a couple of basic questions...Please, forgive the noobness.. this is my first experience of a non cPanel environment...

1/ Does the Plesk "backup" as described in the manual backup individual MySQL databases? Til now I've been "secure" in the knowledge of a tape backup on the basic plan....and am nervous about data loss!

2/ I note another thread about brute force attacks etc... is there anything I need to do to protect my site, or do I automatically have the same level of 'protection' that I had under basic hosting...??

3/ Does anyone know how many simultaneous connections/logins to mySQL I can have under a VPS? I believe it was 50 under basic hosting...??

4/ Oooh - another question....is it possible to use InnoDB tables on a VPS? I'd love to have the security of transactions again, even if it did mean revisiting all my code...

(I'm sure there will be a ton of questions from me over the next few days/weeks as I try and get up to speed...)
« Last Edit: March 04, 2008, 08:34:27 AM by hairboy » Logged

hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #1 on: March 04, 2008, 06:30:01 PM »

Are these questions so poor that nobody can answer them? Maybe they've gone to the billing department at Lunarpages by mistake - *those* guys can take a week to answer!  Sad

My site is still in the process of being transferred, so I don't have access to anything yet, but I'm really trying to use my time wisely and learn.... please guys, throw me some info.....50+ views and no reply even to tell me how dumb my questions were?  Confused
Logged

perestrelka
Administrator
Jedi
*****
Offline Offline

Posts: 980



« Reply #2 on: March 04, 2008, 09:22:29 PM »

Hi,

Dedicated support would be happy to reply on your questions in timely manner. Their email is vps@lunarpages.com. As for the questions you stated:

Quote
1/ Does the Plesk "backup" as described in the manual backup individual MySQL databases? Til now I've been "secure" in the knowledge of a tape backup on the basic plan....and am nervous about data loss!

That's correct, Plesk Backup archives user databases along the accounts data. In order to be safe, I would recommend using the backup FTP account with 1GB of space that comes with VPS plan to not keep the backup on the same VPS.

Quote
2/ I note another thread about brute force attacks etc... is there anything I need to do to protect my site, or do I automatically have the same level of 'protection' that I had under basic hosting...??

The first thing to be safe from this kind of attacks is to use secure passwords (more than 8 chars long combination of lower or upper case letters, numbers and punctuation symbols). If you would like to have a software blocking brute-forcing IPs or restrict login access by IP addresses it will be your responsibility to setup this. Lunarpages admins can assist you with that for $75/hour fee.

Quote
3/ Does anyone know how many simultaneous connections/logins to mySQL I can have under a VPS? I believe it was 50 under basic hosting...??

There is no restrictions from the shared hosting on VPS. The only limit for you will be resources of your VPS server.

Quote
4/ Oooh - another question....is it possible to use InnoDB tables on a VPS? I'd love to have the security of transactions again, even if it did mean revisiting all my code...

Yes, it is possible. You can configure VPS and its software such as MySQL as per your needs.

Please do not hesitate to ask if you have further questions.
Logged

Kind Regards,
Vlad Artamonov
hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #3 on: March 14, 2008, 12:20:54 AM »

Thanks for all that.

1/ Ok...so the backup FTP account - I note that it says on the VPS sales page that it costs $25 setup and $20/10Gb. Is that a monthly cost, or just one off?

2/ Thanks for the info - just to further elaborate, what I'm worried about is whether my site is actually less secure under VPS than it was under Basic Hosting?
Logged

perestrelka
Administrator
Jedi
*****
Offline Offline

Posts: 980



« Reply #4 on: March 14, 2008, 02:28:26 PM »

Quote
1/ Ok...so the backup FTP account - I note that it says on the VPS sales page that it costs $25 setup and $20/10Gb. Is that a monthly cost, or just one off?

Setup fee is one time, and $20 per 10 GB of backup space is the monthly price.

Quote
2/ Thanks for the info - just to further elaborate, what I'm worried about is whether my site is actually less secure under VPS than it was under Basic Hosting?

If mainly we take care about the security on the shared hosting plans such as Basic plan is, you are also responsible for security of your VPS server. We maintain the security of the hardware node on the VPS plan. You need to be sure you don't run unneeded services on it and use secure passwords for accounts on the server, especially for the ones with admin privileges. VPS and sites hosted on it also should run up to date software that does not contain known vulnerabilities. Meeting these conditions, your VPS will not be less secure than shared plans and even you can get it more secure as there are some things that can't be disabled on shared servers due to the nature of the shared hosting.

I hope this helps.
Logged

Kind Regards,
Vlad Artamonov
hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #5 on: March 16, 2008, 08:41:10 AM »

Thanks for the information. Forgive me as I continue to ask more questions!  Confused

So, If I have extra space available as backup for FTP, and I have several databases, each consisting a few dozen tables, each database being about 1Gb in size...

Ideally I'd like to keep the backup databases as current as possible to minimise data loss..... Some tables only receive inserts, some tables are updated regularly...... I really don't know what strategies to use? Has anyone got any advice?

EDIT: Would this method of MySQL replication be possible using the FTP backup space? http://www.softwareprojects.com/resources/programming/t-how-to-move-copy-a-live-mysql-database-1257.html
« Last Edit: March 16, 2008, 09:34:07 AM by hairboy » Logged

perestrelka
Administrator
Jedi
*****
Offline Offline

Posts: 980



« Reply #6 on: March 19, 2008, 04:51:24 AM »

Hi,

Unfortunately, FTP assumes only FTP access so the howto you found won't work. What I would try to use in your case is tables with MyISAM type and lftp program that can do directory mirroring by FTP.
Logged

Kind Regards,
Vlad Artamonov
hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #7 on: March 25, 2008, 08:39:22 AM »

For anyone that is interested, what I have chosen as my 'backup' strategy is to set up replication as per http://www.howtoforge.com/mysql_database_replication by purchasing a second VPS on another physical server to act as a slave.

I have chosen this because I'm not worried about "bad" data coming from my application per se - I can deal with undoing updates to the game database using transaction logs etc if need be, and I test things thoroughly prior to any major implementations. My main concern here is actual backing up - ie safeguarding against a server crash.

I'll get back to you in the next day or two and let you all know how it's going - currently got itchy fingers and tired eyes waiting for the techos to confirm that they are starting to move my site from Basic to VPS  Clapping Hypno
Logged

perestrelka
Administrator
Jedi
*****
Offline Offline

Posts: 980



« Reply #8 on: March 25, 2008, 11:11:05 PM »

Hi Hairboy,

Thanks for sharing your experience. Let us know about how it goes Wink
Logged

Kind Regards,
Vlad Artamonov
hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #9 on: April 03, 2008, 11:26:51 PM »

Well, in theory it should be brilliant. In reality, I strongly advise anyone that wants master/slave replication to leave it alone, unless you know how to do it yourself.  Crying or Very sad
Logged

hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #10 on: April 04, 2008, 04:29:11 AM »

...tragedy....

Before I'd been told I was all in the clear to start my mySQL backup ppolicy on the slave, my databases have for some reason all been reverted back to where they were a week ago....the time of my move to VPS.

Server brain-spasm? Problems with replication or replication setup? "Accident" by a techo?

I've got no idea...All I know is that I've just lost a week worth of data, a week worth of new customer information.....and the trust of a lot of customers in a startup business.

Can Lunarpages recover my information from their VPS backup records? I sure hope so.... Doh
Logged

hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #11 on: April 06, 2008, 01:16:27 AM »

Lunarpages managed to recover some data that wasn't toooo old for me....but couldn't manage to successfully restore it.
Neither could they manage to restart mysql replication for me, or a few other general server-debugging tasks. Well, maybe they might have been able to do it but after almost a week of continual downtime I was not really wanting to sit around waiting for technical help.

I strongly recommend anyone considering mysql replication to learn how to do this yourself, because if anything goes wrong, you're going to have to fix it without any reliance on tech support.

So..in the past 72 hours (never having logged into a command shell before in my life excepting my Amiga 20 years ago!) I have learned how to:
1/ rsync files from one VPS to another
2/ start and stop mysql & replication
3/ Change a mysql password from a root SSH
4/ obtain status reports on master/slave relationship and use those to debug mysql replication
5/ Manually bring replication back into sync
6/ monitor replication and use mysql command line to manually/randomly query the slave database to verify consistency with the master

I'm pretty impressed with myself. Now, the next step in my learning - shell scripting.

If anyone can help at all, that would be cool, but I'm expecting to probably have to work this out myself.
My database backup policy is this (and I need to write a script to do part 2 via CRON)
1/ Master -> Slave replication (over 2x VPS - insurance against a primary server crash)
2/ Every 12 hours on slave
         a/ Stop mysql
         b/ cycle through all mysql databases (all have directory name xxxx99_databasename)
               i/ myisamchk the tables in this database.
               ii/ if the database has no errors, zip a copy of the raw database directory and send an email to confirm this database backed up
               iii/ if the database has an error, take no action but email to warn of the corruption to slave database
         c/ if there were no errors at all in any databases during step b, then delete the zip files that are older than 24 hours old.

I figure thats a fairly secure policy - it means I have accurate up-to-date data spanning 2 servers, and also 2xhistorical data files which are guaranteed to contain "good" tables....and a ready-warning system whenever database corruption occurs

Anyone able to help me write a script like this? Or give me a pointer on where to start?
Logged

perestrelka
Administrator
Jedi
*****
Offline Offline

Posts: 980



« Reply #12 on: April 07, 2008, 02:41:55 AM »

Hi,

I am sorry to hear about the inconveniences you have experienced with regards to the MySQL replication setup. As for the backup script it would be advisable to use scripting language you know to code in it. If I would be writing the script myself, bash would be my choice as the most simplest solution. You can find a great tutorial for it at http://tldp.org/LDP/abs/html/
Logged

Kind Regards,
Vlad Artamonov
hairboy
Spacescooter Operator
*****
Offline Offline

Posts: 39


If I were a jockey..??


WWW
« Reply #13 on: April 11, 2008, 02:35:56 AM »

Yep - I've written a script that is working fine. I had no knowledge of scripting before but it's come off ok and doing its' thing  Clapping

It follows the pseudo code I wrote above...although I omitted the "conditional backup based on mysql check" at a later date, because it seemed that sometimes the slave was shut-down mid transaction and so the mysqlcheck was failing. At least I think that was what caused it! It makes sense I think anyway...I imagine that even when the slave shuts down, mysqld would still have a transaction or two to write, and so the mysqlcheck was spotting them in progress and giving a warning.

If anyone needs a copy of the script I'm happy to share it.
Logged

jetx
Intergalactic Cowboy
*****
Offline Offline

Posts: 59


« Reply #14 on: April 11, 2008, 04:47:03 PM »

Yep - I've written a script that is working fine. I had no knowledge of scripting before but it's come off ok and doing its' thing  Clapping

It follows the pseudo code I wrote above...although I omitted the "conditional backup based on mysql check" at a later date, because it seemed that sometimes the slave was shut-down mid transaction and so the mysqlcheck was failing. At least I think that was what caused it! It makes sense I think anyway...I imagine that even when the slave shuts down, mysqld would still have a transaction or two to write, and so the mysqlcheck was spotting them in progress and giving a warning.

If anyone needs a copy of the script I'm happy to share it.

That's actually pretty impressive. I'd like to see the script, please email it to spidersfrommarsatgmaildotcom. Thanks in advance!
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM