HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Mysql FLUSH LOGS in live server with replication

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
logsflushwithreplicationlivemysqlserver

Problem

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

Solution

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.)

Context

StackExchange Database Administrators Q#130186, answer score: 5

Revisions (0)

No revisions yet.