Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-06-2010, 11:46 AM
|
#1
|
Member
Registered: Nov 2009
Posts: 109
Rep:
|
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: - Copy all data (and database) from old machine to the new machine using rsync
- Make an announcement that at scheduled time, there will be a down time.
- Reduce TTL for DNS (www.mysite.com)
- Make a dummy name for testing (dummy.mysite.com)
- make dummy.mysite.com as a mirror copy (at certain point) of www.mysite.com
- 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
- re-rsync databases on both machine
- After rsync completed, turn www.mysite.com on new machine online
My question is: - Will this plan works?
- 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...
- 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
|
|
|
10-06-2010, 01:20 PM
|
#2
|
Member
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284
Rep:
|
yes rsync will sync up the changes once the bulk has been copied over.
man rsync will show you all you need.
|
|
|
10-06-2010, 09:05 PM
|
#3
|
Member
Registered: Nov 2009
Posts: 109
Original Poster
Rep:
|
@Mago: Thanks, Man! This bring me a relief 
|
|
|
10-07-2010, 01:17 AM
|
#4
|
Member
Registered: Jul 2006
Location: Belgium
Distribution: Debian, Fedora, CentOS, Windows
Posts: 361
Rep: 
|
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.
|
|
|
10-07-2010, 02:32 AM
|
#5
|
Member
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724
Rep: 
|
Agree with Blue Ice. I would like to suggest you use mysqldump.
|
|
|
10-09-2010, 08:56 PM
|
#6
|
Member
Registered: Nov 2009
Posts: 109
Original Poster
Rep:
|
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)?
|
|
|
10-09-2010, 09:06 PM
|
#7
|
Member
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284
Rep:
|
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
|
|
|
10-09-2010, 09:29 PM
|
#8
|
Member
Registered: Nov 2009
Posts: 109
Original Poster
Rep:
|
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 
|
|
|
10-09-2010, 09:39 PM
|
#9
|
Member
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with 2.6.16.18 (still off the hook)
Posts: 284
Rep:
|
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.
|
|
|
10-10-2010, 10:23 PM
|
#10
|
Member
Registered: Nov 2009
Posts: 109
Original Poster
Rep:
|
Tomorrow will be the D-Day
Today we prepare everything that needed. 
|
|
|
10-15-2010, 05:04 AM
|
#11
|
Member
Registered: Nov 2009
Posts: 109
Original Poster
Rep:
|
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 
|
|
|
All times are GMT -5. The time now is 02:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|