LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-06-2010, 11:46 AM   #1
yoachan
Member
 
Registered: Nov 2009
Posts: 109

Rep: Reputation: 16
Moving to a new machine


Dear all,

We are planning to move our site to a new machine, with as little as down time as possible. The site is a small forum, so it can always changing every minutes.
As a note both machine are remote machine. We only have ssh tunnel and http connection.
So here is what we have for a plan:
  1. Copy all data (and database) from old machine to the new machine using rsync
  2. Make an announcement that at scheduled time, there will be a down time.
  3. Reduce TTL for DNS (www.mysite.com)
  4. Make a dummy name for testing (dummy.mysite.com)
  5. make dummy.mysite.com as a mirror copy (at certain point) of www.mysite.com
  6. At scheduled time, make both www.mysite.com and dummy.mysite.com offline, and point DNS www.mysite.com to new machine, pointing the same directory as dummy.mysite.com, and remove name for dummy.mysite.com
  7. re-rsync databases on both machine
  8. After rsync completed, turn www.mysite.com on new machine online

My question is:
  1. Will this plan works?
  2. Can rsync copy changed part of a file instead of copying whole file? Assuming mysql MYD file changed because of mysql transaction, can rsync copy only part of file that changed instead of copying whole file again? Copying over 100+ MB mysql file only because of mysql add a single record won't be a smart move...
  3. Does anyone have a better and easier plan to do this?

This is my first experience moving host on a live site.
Any help appreciated.

Thanks and regards,

yoachan
 
Old 10-06-2010, 01:20 PM   #2
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284

Rep: Reputation: 33
yes rsync will sync up the changes once the bulk has been copied over.

man rsync will show you all you need.
 
Old 10-06-2010, 09:05 PM   #3
yoachan
Member
 
Registered: Nov 2009
Posts: 109

Original Poster
Rep: Reputation: 16
@Mago: Thanks, Man! This bring me a relief
 
Old 10-07-2010, 01:17 AM   #4
Blue_Ice
Member
 
Registered: Jul 2006
Location: Belgium
Distribution: Debian, Fedora, CentOS, Windows
Posts: 361

Rep: Reputation: Disabled
I wouldn't use rsync on the databases. I would do a backup and restore or set up mysql replication. rsync'ing databases can cause problems with the integrity of the database.
 
Old 10-07-2010, 02:32 AM   #5
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
Agree with Blue Ice. I would like to suggest you use mysqldump.
 
Old 10-09-2010, 08:56 PM   #6
yoachan
Member
 
Registered: Nov 2009
Posts: 109

Original Poster
Rep: Reputation: 16
The problem is dumped database will takes time to be copied over.
For this two machines were thousands mile away. One in US and one in Asia.

Any other solution(s)?
 
Old 10-09-2010, 09:06 PM   #7
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284

Rep: Reputation: 33
How big is the dump?.
How much does it weight compress?.
How long is the maintenance window?

Which engine are you using for MySQL?

There are lots of ways to skin a cat, one just need some info.

Last edited by mago; 10-09-2010 at 09:07 PM. Reason: Incomplete
 
Old 10-09-2010, 09:29 PM   #8
yoachan
Member
 
Registered: Nov 2009
Posts: 109

Original Poster
Rep: Reputation: 16
The biggest chunk is 550MB, and will take transfer time 30-60 minutes.
Other databases are smaller. To move everything will takes approximately two hours...
I didn't do compression, but I'm using on the fly compression during rsync/scp.

Just thinking that direct rsync will be easier, faster, and fail-proof
We just want our down time as short as it can, just for user's comfort
 
Old 10-09-2010, 09:39 PM   #9
mago
Member
 
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284

Rep: Reputation: 33
Well if you use InnoDB and you can enable binary logs, upload the dump of the day before and sync up the logs of the day, then import from the logs up to the date.

Another way to go is to compress on the fly the same day:
Code:
mysqldump --opt --single-transaction -uuser -ppassword database | gzip -9 | ssh user@remoteserver "dd of=/path/for/dump/backup-`date +%Y%m%d`.sql.gz"
Or you can dump all databases at once, compress and transfer them with the same method, usually the compression rate is 8/9 to 1.

So if 550MB is the largest this way you transfer about 60MB then uncompress on destination server and import it.

Let me know how it goes.
 
Old 10-10-2010, 10:23 PM   #10
yoachan
Member
 
Registered: Nov 2009
Posts: 109

Original Poster
Rep: Reputation: 16
Tomorrow will be the D-Day
Today we prepare everything that needed.
 
Old 10-15-2010, 05:04 AM   #11
yoachan
Member
 
Registered: Nov 2009
Posts: 109

Original Poster
Rep: Reputation: 16
Huff... huff...
All data moved.
rsync home directories and document_roots,
dump and zip databases than transfers.

Still waiting for DNS to propagate.

Thanks for everyone's help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Transmission to a new machine grumblenz Linux - Software 3 09-29-2010 05:56 AM
moving samba to another machine shishirkotkar Linux - Software 3 05-02-2008 12:48 AM
Moving website from one machine to another praisehim Linux - Newbie 2 11-11-2007 01:17 PM
Moving Debian from one machine to another hypernetics Linux - General 2 10-02-2007 10:41 AM
Moving accounts from a machine to another machine eyt Linux - Newbie 3 10-01-2003 02:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration