I configured master slave replication and it worked fine however it stops working after 5 min or so! Although slave status show that replication is fine, however whatever I insert in master isn't replicating in slave
This is the tutorial I followed.
Things only start replicating again when I run the command service mysqld restart on slave
# nano /etc/my.cnf
server-id = 1
binlog-do-db=db0
binlog-do-db=db2
binlog-do-db=db3
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
# /etc/init.d/mysqld restart
# mysql -u root -pMorphie5
GRANT REPLICATION SLAVE ON *.* TO 'xgears'@'137.116.213.135' IDENTIFIED BY 'Morphie5';
FLUSH PRIVILEGES;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
mysql>exit;
# mysqldump -u root --all-databases --master-data > /root/dbdump.db
mysql> UNLOCK TABLES;
mysql> quit;
scp /root/dbdump.db root@137.116.213.135:/root/
SERVER SIDE
# nano /etc/my.cnf
server-id = 2
replicate-do-db=db0
replicate-do-db=db2
replicate-do-db=db3
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
# mysql -u root < /root/dbdump.db
# /etc/init.d/mysqld restart
# mysql -u root -p
slave stop;
CHANGE MASTER TO MASTER_HOST='40.85.93.234', MASTER_USER='xgears', MASTER_PASSWORD='Morphie5', MASTER_LOG_FILE='mysql-bin.000007', MASTER_LOG_POS=342;
slave start;
show slave status \G