While MySQL is one of the simplest RDBMS, it gives vast opportunity to play around!
One of the common question asked in most of the interviews is about Master-Master Circular Replication(means, both servers are master and both are slaves), though its not so practical to be use in a environment where you need high performance.. !!
Here are the brief steps for setting up such a set up..! :
* Install MySQL on both the servers which are our masters
* Configure my.cnf with below options:
server-id = 2
log_bin = /var/log/mysql/mysql-bin.log
log-slave-updates
[give your convenient values, but make sure server-id is unique]
Note:
log-slave-updates->
Normally, a slave does not log to its own binary log any
updates that are received from a master server. This option tells the
slave to log the updates performed by its SQL thread to its own binary log.
This option is must in any chain replication, as well.
* Start MySQL on both the servers and make a note of 'SHOW MASTER STATUS' values.
* Using the above values of each, set the replication parameters on the other
server. And start slave.
slave stop;
CHANGE MASTER TO MASTER_HOST = '3.3.3.3',
MASTER_USER = 'replicator',
MASTER_PASSWORD = 'password',
MASTER_LOG_FILE = 'mysql-bin.000001',
MASTER_LOG_POS = 107;
slave start;
No comments:
Post a Comment
Note: only a member of this blog may post a comment.