Is there anyway to lock master log position? every time I restart putty master log position is different!
e.g if currently it is at
+------------------+----------+------------------------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+------------------------------+------------------+
| mysql-bin.000003 | 431 | aqsacheck,xgeartrack,xgeardb | |
+------------------+----------+------------------------------+------------------+
Than after restarting putty the position is different
+------------------+----------+------------------------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+------------------------------+------------------+
| mysql-bin.000003 | 543 | aqsacheck,xgeartrack,xgeardb | |
+------------------+----------+------------------------------+------------------+
What can I do that the postion remains the same even if I restart putty?
The issue is that that every time I restart putty I have to start slave again and change master again if I don't do that the replication doesn't work.
I used following steps for replication
MASTER SIDE
server-id = 1
binlog-do-db=tecmint
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 -p
mysql> GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'192.168.1.2' IDENTIFIED BY 'your_password';
mysql> FLUSH PRIVILEGES;
mysql> FLUSH TABLES WITH READ LOCK;
mysql> SHOW MASTER STATUS;
# mysqldump -u root -p --all-databases --master-data > /root/dbdump.db
mysql> UNLOCK TABLES;
mysql> quit;
scp /root/dbdump.db root@192.168.1.2:/root/
SLAVE SIDE
# vi /etc/my.cnf
replicate-do-db=tecmint
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 -p < /root/dbdump.db
# /etc/init.d/mysqld restart
# mysql -u root -p
mysql> slave stop;
mysql> CHANGE MASTER TO MASTER_HOST='192.168.1.1', MASTER_USER='slave_user', MASTER_PASSWORD='yourpassword', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=11128001;
mysql> slave start;
mysql> show slave status\G
for the first time it is configured everything works fine the problem occurs when I restart putty the master log file is different and I have to run this command again (with new master log position)
mysql> CHANGE MASTER TO MASTER_HOST='192.168.1.1', MASTER_USER='slave_user', MASTER_PASSWORD='yourpassword', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=11128001;
which I believe is wrong because when ever I start putty the replication should start automaticallybut I first have to check master log position and run the query mentioned above to start slave.