Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Jun 23, 2015 1:08 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Hi, I'm a new user at Linode!

I just setup my Nginx server with MySQL, PHP, Laravel and PhpMyAdmin. Everything works well, however I'd like to set it up so when the automatic backup kicks in the user gets a page showing, 'Currently Unavailable Due To Maintenance'. What do I have to do to get my site to work this way?


Top
   
PostPosted: Tue Jun 23, 2015 1:16 pm 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
Why would the site be unavailable when the backup runs?

- Les


Top
   
PostPosted: Tue Jun 23, 2015 1:18 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Basically I want it to be in a maintenance state so users can not interact with the site. This is to prevent database transactions getting backed up in a weird state.

Or do I not have to worry about this when Linode does an auto backup?


Top
   
PostPosted: Tue Jun 23, 2015 1:42 pm 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
Linode's Backup Service doesn't affect anything running on the Linode when it happens. For your database, just have automysqlbackup or some such dump out the database to a file or some such once a day. Unless you have a massive DB or very heavy *writes* (unlikely), nothing should be affected.

- Les


Top
   
PostPosted: Tue Jun 23, 2015 1:49 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
I understand that Linode's backup service doesn't influence anything running when it happens. But can't the backup of the database snapshot be in an odd state if users are interacting with it as it's being backed up? I have queries which update more than one table and multiple rows at a time. If I were to use automysqlbackup, wouldn't I want to still display a page showing that the site is under maintenance during that duration?


Top
   
PostPosted: Tue Jun 23, 2015 2:00 pm 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
Yes, you want to dump the DB to a file once a day.

No, automysqlbackup shouldn't impact folks using the site. The exception, as I noted, would be write-heavy operations (think payment processing or the like).

- Les


Top
   
PostPosted: Tue Jun 23, 2015 2:06 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Do you mean write-heavy operations (like payment processing) would impact Linode's snapshot but not automysqlbackup? Or do you mean it would impact both if the write operations are heavy enough?


Top
   
PostPosted: Tue Jun 23, 2015 2:16 pm 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
Quote:
No, automysqlbackup shouldn't impact folks using the site. The exception, as I noted, would be write-heavy operations (think payment processing or the like).


Top
   
PostPosted: Tue Jun 23, 2015 2:23 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Sorry, I just needed some clarification because I'm planning on adding payment processing in the near future. Optimally never taking the page down would be the best and I was hoping that would be the case. But it sounds like automysqlbackup could be impacted by write-heavy operations. I'm not much of a server guy. I'm more of a C# guy. It sounds like I should stop user interactions while backing up the database. Do you know any good way to do this? I'm pretty open to suggestions and I really appreciate your input.


Top
   
PostPosted: Tue Jun 23, 2015 2:29 pm 
Offline
Senior Member

Joined: Mon Jul 05, 2010 5:13 pm
Posts: 392
My advice to you: don't to payment processing. It's damn hard to get right, it's damn easy to get credit cards stolen, and then you're in for a world of pain. There are all kinds of fun payment processors that you can offload that to: do it.

If you actually want to take down the DB, you should look into horizontally scalable datastores such that you can take a backup without taking down the actual service of the DB. Of note, you're going to need a server guy unless you want that to end with "oh god oh god please can a server guy come save me". Highly available services are hard work.

- Les


Top
   
PostPosted: Tue Jun 23, 2015 2:40 pm 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Thanks for the detailed reply. That's good to know. At the moment it's just me working on the site in my free time, and I haven't even started the database migration yet from my local machine to Linode, but if it makes any money and makes sense to do so I'll definitely be hiring a server guy full time.


Top
   
PostPosted: Wed Jun 24, 2015 3:42 am 
Offline
Newbie

Joined: Wed Apr 03, 2013 11:19 am
Posts: 3
Relatively simple way of backing up the database without interruptions with this cron:

Code:
25 3 * * 4 mysqldump -u USERNAME -pPASSWORD -h localhost --single-transaction --quick --ignore-table=mysql.event --databases LIST OF DATABASES | gzip > /home/bakki/mysqld_db_dumb_thursday.gz


Just add few more lines for each day and if you want to do it every 12 hours. preferably schedule it to happen just before linodes own backup.

-Tuxie


Top
   
PostPosted: Wed Jun 24, 2015 10:22 am 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Thanks for the reply! I'll definitely check out the documentation to understand the commands. Can you explain the reasoning behind scheduling it before Linode's own backup? Is there a disadvantage doing it after Linode's?


Top
   
PostPosted: Wed Jun 24, 2015 10:24 am 
Offline
Newbie

Joined: Wed Apr 03, 2013 11:19 am
Posts: 3
Well if your system fails and you need to use linodes backup to restore you would want to have the most recent database backup to be as recent as possible and not half a day or day old.


Top
   
PostPosted: Wed Jun 24, 2015 10:30 am 
Offline
Junior Member

Joined: Sat Mar 28, 2015 12:28 pm
Posts: 32
Ah, I see. So you're treating the manual mysqldump as a backup of linode's own backup. That makes sense. I'll do it that way too.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group