Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| 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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-04-2008, 03:17 PM
|
#1
|
|
LQ Newbie
Registered: Dec 2003
Location: Chennai,India
Distribution: Ubuntu
Posts: 11
Rep:
|
How to find whether file transfer has completed on scp or mysqldump.
Hi All,
I want to speed up a process that goes in our organization. Basically it consists of 3 steps
1. from box1 do a mysqldump of a database(in mysql)
2. scp the file mysqldump file to another remote machine say box2
3. import the mysqldump in mysql server on box2.
The database size is really huge in terms of a couple of GBs. Also the network speed is only in couple of Kbps. So the overall process takes very long time. I want to speed this up by doing parellelizing the process. This is my idea.
1. Change the mysqldumping process so that it creates one file with all create table statements and then a data file for each table.
2. A process should continously monitor the status of all files being dumped from mysql. And as soon as it sees a file being completely dumpe d it should scp the file from box1 to box2.
3. On box2 a similar process should run as in step 2, which should keep checking for files which are completely scped. And as soon it sees some file being completed transferred should load the file into mysql server corresponding database.
So to be able to do this I need a mechanism to find whether a file has been completely transferred or completely dumped by mysql server. Also I want this process to be bit flexible. As in the mysql server on box2 may not be always running. In which case I just want to do just first 2 steps and do 3rd step whenever possible i.e mysql server on box2 is avaiable again.
Can anyone please tell me how this can be done?
Thanks,
Ganesh
Last edited by ganesh_k; 08-04-2008 at 03:44 PM.
|
|
|
|
08-04-2008, 03:42 PM
|
#2
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 11,778
|
I'd suggest looking in to MySQL Replication:
http://dev.mysql.com/doc/refman/5.1/en/replication.html
Which would be a much better solution. What you're talking about is easily done through some clever scripting, but has lots more moving parts, and is more prone to failure.
|
|
|
|
08-04-2008, 03:53 PM
|
#3
|
|
LQ Newbie
Registered: Dec 2003
Location: Chennai,India
Distribution: Ubuntu
Posts: 11
Original Poster
Rep:
|
Hi,
Thanks TB0ne. But unfortunately I don't have the rights to setup replication from box1. Can you please tell how it can be done through scripting?
Thanks,
Ganesh
|
|
|
|
08-04-2008, 08:36 PM
|
#4
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 14,938
|
Basically, you write a script that creates the backup(s) and then creates a file eg via touch cmd that acts as a signal after a file has completed.
Send the backup file followed by the associated signal file. The receiver waits till it sees the signal file before it attempts to load the dump file.
So,
Sender:
1. mysqldump blah to file1.dmp
2. touch file1.sig
3. send file1.dmp
4. send file1.sig
repeat for each dump/sig file pair
Receiver:
wait for sig file, load associated dmp file, remove/archive dmp+sig file
repeat ...
note; to reduce network load, gzip dump file before transmission, gunzip at receiver.
|
|
|
|
08-05-2008, 10:22 AM
|
#5
|
|
LQ Newbie
Registered: Dec 2003
Location: Chennai,India
Distribution: Ubuntu
Posts: 11
Original Poster
Rep:
|
Hi,
Thanks very much for the answer chrism01. I think it was an excellent idea. I got into another problem while trying to create data files for tables in the database. So I am going to try generate sql files with insert statements instead of data files.
Thanks,
Ganesh
|
|
|
|
08-05-2008, 10:27 AM
|
#6
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 11,778
|
Quote:
Originally Posted by ganesh_k
Hi,
Thanks TB0ne. But unfortunately I don't have the rights to setup replication from box1. Can you please tell how it can be done through scripting?
Thanks,
Ganesh
|
If you don't have the rights to set up replication, should you even be doing manual dumps/reloads???
|
|
|
|
08-05-2008, 07:43 PM
|
#7
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 14,938
|
ganesh_k: the mysqldump prog produces what you want, just read up on the optons: http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
TBOne: could be he's only got schema owner rights, not mysql root. iirc, you need mysql root (equiv dba) to do replication.
|
|
|
|
08-06-2008, 09:00 AM
|
#8
|
|
Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 11,778
|
Quote:
Originally Posted by chrism01
|
Quite true...but I still would question why he's trying to perform what's essentially a DBA function, without DBA privs.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:35 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
|
|