Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: MySQL Replication
PostPosted: Sat May 09, 2009 9:04 pm 
Offline
Junior Member

Joined: Sun Jan 20, 2008 8:20 pm
Posts: 25
Can anyone refer me to a good 'How To' regarding MySQL database replication? I have read a number of them but they are all for only one database on a MySQL server, I'd like to replicate every database on my MySQL server to a second Linode, where I will then be running a MySQL Dump backup script. I've tried to go with the MySQL docs on this topic, but they are not very good and seem to make lots of assumptions regarding existing knowledge.
Thanks


Top
   
 Post subject:
PostPosted: Sat May 09, 2009 9:11 pm 
Offline
Senior Member
User avatar

Joined: Sun Feb 08, 2004 7:18 pm
Posts: 562
Location: Austin
Sounds like a great plan.

You can replicate multiple databases simply by having multiple "replicate-do-db" lines in the slave's my.cnf.

Of course you'll also need multiple "binlog-do-db" lines in the master's.


Top
   
 Post subject:
PostPosted: Sun May 10, 2009 1:50 am 
Offline
Newbie

Joined: Sun May 10, 2009 1:26 am
Posts: 3
We do the same kind of thing on http://FootySX.com.au using Linodes.

If you're using MySQL 5.0+, the basic things you'll probably need are:

-------------------
my.cnf (MASTER):
-------------------
[mysqld]
# ... your other settings ...
log-bin=mysql-bin
-------------------
my.cnf (SLAVES):
-------------------
[mysqld]
# Nothing special needed
-------------------

On your Master:
- Create a new user that has global replication permissions.
- Load the initial data that you need (if any).
- At the shell: mysqldump -uroot -p --all-databases --master-data > whatever.dump
- Transfer whatever.dump to the slave Linode.

On your Slaves:
> Login to MySQL and execute the commands: STOP SLAVE; CHANGE MASTER TO MASTER_HOST='THE_MASTER_IP_ADDRESS_OR_HOSTNAME', MASTER_PORT=THE_MASTER_PORT_(PROBABLY_3306), MASTER_USER='THE_REPLICATION_USER_YOU_CREATED', MASTER_PASSWORD='REPLICATION_USER_PASSWORD'
> At the shell: mysql -uroot -p < whatever.dump
> Execute the MySQL command: START SLAVE;

That's from memory, I might have missed a step or two so let me know if it's not working.


Top
   
 Post subject: Thanks!
PostPosted: Fri May 15, 2009 12:57 am 
Offline
Junior Member

Joined: Sun Jan 20, 2008 8:20 pm
Posts: 25
I finally got it working, with the assistance of about 6 tutorials, MySQL docs, and your posts pointed me in the correct direction for all databases.

Cheers


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group