Lest start with the advantage for Master-Master replication: allows data to be copied from either server to the other one, it adds redundancy and increases efficiency when dealing with accessing the data, high availability .
Now about Disadvantage : cost ( instead of using one machine you will be using two machine with high speed connection).
Requirements: two servers ( you can use one server but it is not recommended unless its for testing)
How to setup: lets say you have machines one m1 with IP 1.1.1.1 and machine two m2 with IP 2.2.2.2
1) login to M1 you need to edit the cnf file for it by adding or comment\un-comment the following:
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = MyDB -- if you want the replication for one db, comment this if you want to replicate all the SID
# bind-address = 127.0.0.1
then restart the SID for M1 and log in to MySQL using the command
mysql -uroot -P[port] -p[password]
2) create a replica user using the following command
create user 'replicator'@'M2' identified by 'password'; -- note you can use the IP instead of the host name
3) Next grant the replication privliges to the replica user using:
grant replication slave on *.* to 'replicator'@'M2';
4) check the master status to get the log id
** after finish configuration the server one M1 you need to move to server 2 M2 (the same thing you did for server one but you need to make sure to change the host names as needed):
5) edit the cnf file but make sure the server id it not the same as M1
server-id = 2
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = MyDB -- if you want the replication for one db, comment this if you want to replicate all the SID
# bind-address = 127.0.0.1
6) restart the service
7) create a replication user and provide it with the replication privliges
create user 'replicator'@'M1' identified by 'password';
grant replication slave on *.* to 'replicator'@'M1';
now lets configure the master for M2:
slave stop;
CHANGE MASTER TO MASTER_HOST = '1.1.1.1', MASTER_USER = 'replicator', MASTER_PASSWORD = 'password', MASTER_LOG_FILE = 'mysql-bin..xxxxx', MASTER_LOG_POS = xxx;
slave start;
8) now check the master status
9) then go back to the M1 and start the load balance:
slave stop;
CHANGE MASTER TO MASTER_HOST = '2.2.2.2', MASTER_USER = 'replicator', MASTER_PASSWORD = 'password', MASTER_LOG_FILE = 'mysql-bin.xxxxx', MASTER_LOG_POS = xxx;
slave start;