Is there a way to include the replication bin log position in the dump file without scripting?
I know there are ways through scripting, appending a line to the dump file etc. But I remember once reading that it's possible through a simple argument in mysqldump, is that true and if yes what's the syntax?
Thanks a lot
You can use mysqlbinlog to read binary log files directly and apply them to the local MySQL server. You can also read binary logs from a remote server by using the --read-from-remote-server option. To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server.
binlog dump is a thread on a master server for sending binary log contents to a slave server. If need more information on different values of Command you can refer to: http://dev.mysql.com/doc/refman/5.1/en/thread-commands.html.
INTO DUMPFILE is a SELECT clause which writes the resultset into a single unformatted row, without any separators, in a file. The results will not be returned to the client. file_path can be an absolute path, or a relative path starting from the data directory.
By default it does it to the working directory at the time the command was made. You need to redirect the output to a file if you need to save it.
Great, I've found the answer:
the --master-data option allows this
mysqldump --master-data=1 ... needs to be run on the master and will include a sql that will change the MySQL instance's master to the current file/log position automatically.
if 2 is used instead of 1 then it only writes a comment, which is also useful for manual setups...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With