Solved

Syncing old server to new - MySQL

Posted on 2014-02-14
9
201 Views
Last Modified: 2014-02-25
We have a web server that is crashing/unstable - and a new server that has been bare-metal installed from a backup from broken server about a week old.  There is, however, new data (both mysql and actual PHP files.)

I'm going to break this up into two questions - this is just for the MySQL.

How would you recommend I go about syncing up just the newer files?  Is there a way for me to just transfer over the relevant MySQL files and doing so will it automatically "update" due to the replacement?  My normal way of doing it would be to go site by site and through phpMyAdmin export the tables/databases...then import them into the databases on the new server...but that will kinda suck.  Is there a quicker/more efficient way of doing it?

Thanks in advance!
0
Comment
Question by:erzoolander
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 39

Expert Comment

by:noci
ID: 39861373
You should be able to make an export from the old database & import that into the new one.
As long as the tables are NOT the same in the same 'database' you can import data.
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39862113
Have you try tar up the entire directory (mysql/php) from source and extract it to the target?
0
 
LVL 39

Expert Comment

by:noci
ID: 39862563
@MAzdajai, that can only be done if the source was halted before the copy is taken
AND more important if the replica doesn't need to be merged into an existing database on the target.

Otherwise you will delete all existing data on the destination.
0
 
LVL 13

Expert Comment

by:Sandy
ID: 39864443
Create Master/ Slave config and perform the replication once done convert slave in master.

TY/SA
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 21

Expert Comment

by:Mazdajai
ID: 39865163
It sound like the new server is not yet in production and the goal is to restore the php and mysqld in the quickest manner. (I could be wrong of course)

IMHO it is easier restore them on the system level versus on the application level... I am not aware you can globally restore all web sites via phpmyadmin.
0
 
LVL 1

Author Comment

by:erzoolander
ID: 39865625
Nope - the PhPMyAdmin level I was pretty much thinking going on a site by site basis...and you're correct...it's not yet in production.  It's still set as a staging server as I'm migrating all of the data over.

I'd LIKE to be as quick as possible about it - so I'm wondering if there's a way to go on to the old server and say "Export everything" from shell/root...and then go to the new server and essentially "restore" with a similar command to re-import everything back in.

My only concern about that - however - is that the system is administered by PLESK...and I'd be afraid that doing a global export might screw something up.  So I'd rather just say Dump databases A, B, C, D and then on the new server import A, B, C, D - leaving everything else in tact.

Is that a decent approach you think - and is there way for me to from root/shell export just a given number of databases/then reimport them?

Thanks!
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39872343
>>if there's a way to go on to the old server and say "Export everything" from shell/root...and then go to the new server and essentially "restore"
Have you consider my above suggestion? This is a cold dump therefore you would need to stop mysql.

It is not possible to export certain database on the system level. You can only achieve  that with the help of mysqldump binary -

mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

Open in new window

0
 
LVL 39

Accepted Solution

by:
noci earned 500 total points
ID: 39875348
and in the previously mentioned mysqldump --all-databases  can dump ALL relevant databases.
(i.e. not the dictionary databases).
No database needs to be mentioned then:


mysqldump -u root -p[root_password] --all-databases > dumpfilename.sql

Open in new window

or
mysqldump -u root -p[root_password] -A > dumpfilename.sql

Open in new window

0
 
LVL 1

Author Closing Comment

by:erzoolander
ID: 39887744
Gracias!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now