2

I need to run the slow query and unindexed query logging for some time on a live production db with replication. Changing GLOBAL const value sounds like a good solution. This article also provides good read on that..

The problem is that I need to run FLUSH LOGS; on the master / slave. And I'm not sure how that will effect the replication. Can someone tell me the impact of running FLUSH LOGS; on live master and on live slave.

Thanks

  • Is this MySQL? Please edit your post with your RDBMS. – Vérace Feb 23 '16 at 15:15
  • @Vérace Done.. Thnx – Rajat Singhal Feb 23 '16 at 15:17
2

FLUSH LOGS; is safe to do anytime. It will rotate the replication logs; this is harmless; replication knows how to move on to the next log. The binlog is automatically rotated when it exceeds max_binlog_size.

Before 5.6, FLUSH LOGS did not rotate the slowlog. See http://dev.mysql.com/doc/refman/5.6/en/flush.html or the page for your version.

I have never done reset master; I would not include it. I use expire_logs_days for automatically purging binlogs. (If a slave has been offline for that many days and I don't notice it, I deserve the hassle.)

I prefer log_queries_not_using_indexes = OFF; otherwise it clutters the slowlog. (A tiny table without an index is often not-a-real-problem.)

1

using flush logs; then usually reset master will save all unsaved changes to the logs and drop old ones. there is a workaround for it:

If you are using replication, you should not delete old binary log files on the master until you are sure that no slave still needs to use them. For example, if your slaves never run more than three days behind, once a day you can execute mysqladmin flush-logs on the master and then remove any logs that are more than three days old. You can remove the files manually, but it is preferable to use PURGE BINARY LOGS, which also safely updates the binary log index file for you (and which can take a date argument). See Section 13.4.1.1, “PURGE BINARY LOGS Syntax”.

You can display the contents of binary log files with the mysqlbinlog utility. This can be useful when you want to reprocess statements in the log for a recovery operation. For example, you can update a MySQL server from the binary log as follows:

shell> mysqlbinlog log_file | mysql -h server_name

quoted from http://dev.mysql.com/doc/refman/5.0/en/binary-log.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.