I do apologize if this has been asked before but my search skills were not able to turn up a definitive answer.
SITUATION: I have two Windows Server 2012 R2 servers running WAMP 3.06 (which contains MySQL 5.7.14). They are setup for replication with a master-slave configuration using binary logging. I have a PowerShell script that makes a dump of the database each night. The PowerShell code looks like this...
# Variables
. (Join-Path $PSSCriptRoot MySQL_Vars.ps1)
# Backup the database
cmd /C " `"$mysqlDump`" $mysqlRoutineFlags -u $mysqlUser -p`"$mysqlPass`" $mysqlDB > $mysqlBkp"
QUESTION: How could I do this so that when the MySQL dump occurs, it is not written to the binary logs?
Thank you in advance for your help!
-
binlogging on Master? Or on Slave? If you turn it off on the Master, but continue writing to the Master, the Slave will be out of sync with no easy way to get it back in sync.Rick James– Rick James2017年11月21日 19:37:55 +00:00Commented Nov 21, 2017 at 19:37
-
@RickJames I can do it on either, though I would prefer to do it on Master. Is there a way to suspend bin logging for a specific session?sudosysadmin– sudosysadmin2017年11月21日 20:51:09 +00:00Commented Nov 21, 2017 at 20:51
1 Answer 1
Only "writes" go to the binlog. A backup only does "reads".
Hence "How ... when the MySQL dump occurs, it is not written to the binary logs?" is a non-issue.
(Or, do I not understand the perceived problem??)
-
I guess I'm confused then. When I ran the backup as a scheduled task at night, I would notice that the bin logs were filling up. This database is not publicly accessible so nothing should be happening at night.I have since disabled the task and the bin logs have already rotated so I don't have a bin log to inspect.sudosysadmin– sudosysadmin2017年11月22日 14:07:34 +00:00Commented Nov 22, 2017 at 14:07
-
1The binlogs rotate when (1) they hit the max (1G or 100M or whatever), or (2)
FLUSH LOGSis executed, or (3) mysqld is restarted. Look at the time on the remaining log; determine which case happened then.Rick James– Rick James2017年11月22日 18:54:21 +00:00Commented Nov 22, 2017 at 18:54