Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 17th November 2007, 20:50
cruz cruz is offline
Senior Member
 
Join Date: Apr 2007
Posts: 365
Thanks: 51
Thanked 2 Times in 2 Posts
 
Default question about backing up two databases

I am setting up How To Set Up Database Replication In MySQL on debian perfet setup. I have entered binlog-do-db=exampledb twice, once for each database I want to backup. When I get to the setting up of the mysql, I am not sure what the corect entry is for two databases.
HTML Code:
USE exampledb;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
How can I enter both databases that I want backed up in here? Also on this part, what is the corect way to enter for two databases?
HTML Code:
mysqldump -u root -p<password> --opt exampledb > exampledb.sql
Also in the slave as well. can I enter both databases on here as well?
HTML Code:
mysql -u root -p
Enter password:
CREATE DATABASE exampledb;
quit;
HTML Code:
mysql -u root -p<password> exampledb < /path/to/exampledb.sql
On this I would just add the last line twice with the other database?
HTML Code:
server-id=2master-host=192.168.0.100master-user=slave_usermaster-password=secretmaster-connect-retry=60replicate-do-db=exampledb
Dose this not pertain to my setup if I chose the first setup? (dump) and not (load data from master)?
HTML Code:
If you have not imported the master exampledb with the help of an SQL dump, but want to go the LOAD DATA FROM MASTER; way, then it is time for you now to get the data from the master exampledb:

mysql -u root -p
Enter password:
LOAD DATA FROM MASTER;
quit;

If you have phpMyAdmin installed on the slave you can now check if all tables/data from the master exampledb is also available on the slave exampledb. 


--------------------------------------------------------------------------------

Finally, we must do this:

mysql -u root -p
Enter password:
SLAVE STOP;

In the next command (still on the MySQL shell) you have to replace the values appropriately:

CHANGE MASTER TO MASTER_HOST='192.168.0.100', MASTER_USER='slave_user', MASTER_PASSWORD='<some_password>', MASTER_LOG_FILE='mysql-bin.006', MASTER_LOG_POS=183; 

MASTER_HOST is the IP address or hostname of the master (in this example it is 192.168.0.100). 
MASTER_USER is the user we granted replication privileges on the master. 
MASTER_PASSWORD is the password of MASTER_USER on the master. 
MASTER_LOG_FILE is the file MySQL gave back when you ran SHOW MASTER STATUS; on the master. 
MASTER_LOG_POS is the position MySQL gave back when you ran SHOW MASTER STATUS; on the master. 
Now all that is left to do is start the slave. Still on the MySQL shell we run

START SLAVE;
quit;

That's it! Now whenever exampledb is updated on the master, all changes will be replicated to exampledb on the slave. Test it! 


Thank you for explaining this to me.
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
phpmyadmin showing no databases nolimitek Installation/Configuration 5 15th November 2007 16:05
mysql migration question... crypted General 1 22nd April 2007 23:04
BUG counting reseller's databases Davide Installation/Configuration 4 11th August 2006 08:45
site - databases trueshanti Installation/Configuration 20 26th May 2006 01:28
Recovering unlinked mysql databases and users... Dave Lane Installation/Configuration 2 10th May 2006 19:45


All times are GMT +2. The time now is 16:49.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.