4.6.9 mysqlbinlog — Utility for Processing Binary Log Files处理二进制日志文件的实用程序

4.6.9.1 mysqlbinlog Hex Dump Formatmysqlbinlog十六进制转储格式
4.6.9.2 mysqlbinlog Row Event Displaymysqlbinlog行事件显示
4.6.9.3 Using mysqlbinlog to Back Up Binary Log Files使用mysqlbinlog备份二进制日志文件
4.6.9.4 Specifying the mysqlbinlog Server ID指定mysqlbinlog服务器ID

The server's binary log consists of files containing events that describe modifications to database contents. The server writes these files in binary format. 服务器的二进制日志由包含描述数据库内容修改的“事件”的文件组成。服务器以二进制格式写入这些文件。To display their contents in text format, use the mysqlbinlog utility. 要以文本格式显示其内容,请使用mysqlbinlog实用程序。You can also use mysqlbinlog to display the contents of relay log files written by a replica server in a replication setup because relay logs have the same format as binary logs. 您还可以使用mysqlbinlog显示复制设置中副本服务器写入的中继日志文件的内容,因为中继日志的格式与二进制日志相同。The binary log and relay log are discussed further in Section 5.4.4, “The Binary Log”, and Section 17.2.4, “Relay Log and Replication Metadata Repositories”.二进制日志和中继日志将在第5.4.4节,“二进制日志”第17.2.4节,“中继日志和复制元数据存储库”中进一步讨论。

Invoke mysqlbinlog like this:像这样调用mysqlbinlog

mysqlbinlog [options] log_file ...

For example, to display the contents of the binary log file named binlog.000003, use this command:例如,要显示名为binlog.000003的二进制日志文件的内容,请使用以下命令:

mysqlbinlog binlog.0000003

The output includes events contained in binlog.000003. For statement-based logging, event information includes the SQL statement, the ID of the server on which it was executed, the timestamp when the statement was executed, how much time it took, and so forth. 输出包括binlog.000003中包含的事件。对于基于语句的日志记录,事件信息包括SQL语句、执行它的服务器的ID、执行语句的时间戳、花费的时间等等。For row-based logging, the event indicates a row change rather than an SQL statement. 对于基于行的日志记录,事件表示行更改,而不是SQL语句。See Section 17.2.1, “Replication Formats”, for information about logging modes.有关日志记录模式的信息,请参阅第17.2.1节,“复制格式”

Events are preceded by header comments that provide additional information. For example:事件前面有提供附加信息的标题注释。例如:

# at 141
#100309  9:28:36 server id 123  end_log_pos 245
  Query thread_id=3350  exec_time=11  error_code=0

In the first line, the number following at indicates the file offset, or starting position, of the event in the binary log file.在第一行中,在at后面的数字表示二进制日志文件中事件的文件偏移量或起始位置。

The second line starts with a date and time indicating when the statement started on the server where the event originated. For replication, this timestamp is propagated to replica servers. 第二行以日期和时间开头,指示语句在事件发生的服务器上何时开始。对于复制,此时间戳会传播到副本服务器。server id is the server_id value of the server where the event originated. server id是事件发生的服务器的server_id值。end_log_pos indicates where the next event starts (that is, it is the end position of the current event + 1). end_log_pos表示下一个事件开始的位置(即当前事件+1的结束位置)。thread_id indicates which thread executed the event. exec_time is the time spent executing the event, on a replication source server. thread_id表示哪个线程执行了该事件。exec_time是在复制源服务器上执行事件所花费的时间。On a replica, it is the difference of the end execution time on the replica minus the beginning execution time on the source. 在副本上,它是副本上的结束执行时间减去源上的开始执行时间的差值。The difference serves as an indicator of how much replication lags behind the source. 这种差异可以作为复制落后于源的程度的指标。error_code indicates the result from executing the event. Zero means that no error occurred.error_code表示执行事件的结果。零表示没有发生错误。

Note注意

When using event groups, the file offsets of events may be grouped together and the comments of events may be grouped together. Do not mistake these grouped events for blank file offsets.当使用事件组时,事件的文件偏移量可以分组在一起,事件的注释可以分组在一起来。不要将这些分组事件误认为是空白文件偏移。

The output from mysqlbinlog can be re-executed (for example, by using it as input to mysql) to redo the statements in the log. mysqlbinlog的输出可以重新执行(例如,将其用作mysql的输入),以重做日志中的语句。This is useful for recovery operations after an unexpected server exit. 这对于服务器意外退出后的恢复操作非常有用。For other usage examples, see the discussion later in this section and in Section 7.5, “Point-in-Time (Incremental) Recovery”. 有关其他使用示例,请参阅本节后面的讨论和第7.5节,“时间点(增量)恢复”To execute the internal-use BINLOG statements used by mysqlbinlog, the user requires the BINLOG_ADMIN privilege (or the deprecated SUPER privilege), or the REPLICATION_APPLIER privilege plus the appropriate privileges to execute each log event.要执行mysqlbinlog使用的内部USE BINLOG语句,用户需要BINLOG_ADMIN权限(或已弃用的SUPER权限),或REPLICATION_APPLIER权限加上适当的权限来执行每个日志事件。

You can use mysqlbinlog to read binary log files directly and apply them to the local MySQL server. 您可以使用mysqlbinlog直接读取二进制日志文件并将其应用于本地MySQL服务器。You can also read binary logs from a remote server by using the --read-from-remote-server option. 您还可以使用--read-from-remote-server选项从远程服务器读取二进制日志。To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server. 要读取远程二进制日志,可以提供连接参数选项来指示如何连接到服务器。These options are --host, --password, --port, --protocol, --socket, and --user.

When binary log files have been encrypted, which can be done from MySQL 8.0.14 onwards, mysqlbinlog cannot read them directly, but can read them from the server using the --read-from-remote-server option. 当二进制日志文件被加密时(可以从MySQL 8.0.14开始),mysqlbinlog不能直接读取它们,但可以使用--read-from-remote-server选项从服务器读取它们。Binary log files are encrypted when the server's binlog_encryption system variable is set to ON. 当服务器的binlog_encryption系统变量设置为ON时,二进制日志文件会被加密。The SHOW BINARY LOGS statement shows whether a particular binary log file is encrypted or unencrypted. SHOW BINARY LOGS语句显示特定二进制日志文件是加密的还是未加密的。Encrypted and unencrypted binary log files can also be distinguished using the magic number at the start of the file header for encrypted log files (0xFD62696E), which differs from that used for unencrypted log files (0xFE62696E). 加密和未加密的二进制日志文件也可以使用加密日志文件文件头开头的幻数(0xFD62696E)来区分,这与用于未加密日志文件的幻数不同(0xFE62696E)。Note that from MySQL 8.0.14, mysqlbinlog returns a suitable error if you attempt to read an encrypted binary log file directly, but older versions of mysqlbinlog do not recognise the file as a binary log file at all. 请注意,从MySQL 8.0.14开始,如果您尝试直接读取加密的二进制日志文件,mysqlbinlog会返回一个合适的错误,但旧版本的mysqlbinlog根本无法将该文件识别为二进制日志文件。For more information on binary log encryption, see Section 17.3.2, “Encrypting Binary Log Files and Relay Log Files”.有关二进制日志加密的更多信息,请参阅第17.3.2节,“加密二进制日志文件和中继日志文件”

When binary log transaction payloads have been compressed, which can be done from MySQL 8.0.20 onwards, mysqlbinlog versions from that release on automatically decompress and decode the transaction payloads, and print them as they would uncompressed events. 当二进制日志事务有效负载被压缩时(可以从MySQL 8.0.20开始执行),该版本的mysqlbinlog版本会自动解压缩和解码事务有效负载,并像解压缩事件一样打印它们。Older versions of mysqlbinlog cannot read compressed transaction payloads. 旧版本的mysqlbinlog无法读取压缩的事务有效负载。When the server's binlog_transaction_compression system variable is set to ON, transaction payloads are compressed and then written to the server's binary log file as a single event (a Transaction_payload_event). 当服务器的binlog_transaction_compression系统变量设置为ON时,事务有效负载被压缩,然后作为单个事件(transaction_payload_event)写入服务器的二进制日志文件。With the --verbose option, mysqlbinlog adds comments stating the compression algorithm used, the compressed payload size that was originally received, and the resulting payload size after decompression.使用--verbose选项,mysqlbinlog会添加注释,说明使用的压缩算法、最初收到的压缩有效载荷大小以及解压缩后的有效载荷大小。

Note注意

The end position (end_log_pos) that mysqlbinlog states for an individual event that was part of a compressed transaction payload is the same as the end position of the original compressed payload. mysqlbinlog为作为压缩事务有效负载一部分的单个事件声明的结束位置(end_log_pos)与原始压缩有效负载的结束位置相同。Multiple decompressed events can therefore have the same end position.因此,多个解压缩事件可以具有相同的结束位置。

mysqlbinlog's own connection compression does less if transaction payloads are already compressed, but still operates on uncompressed transactions and headers.如果事务有效负载已经压缩,mysqlbinlog自己的连接压缩会做得更少,但仍然对未压缩的事务和标头进行操作。

For more information on binary log transaction compression, see Section 5.4.4.5, “Binary Log Transaction Compression”.有关二进制日志事务压缩的更多信息,请参阅第5.4.4.5节,“二进制日志事务编码”

When running mysqlbinlog against a large binary log, be careful that the filesystem has enough space for the resulting files. 当对大型二进制日志运行mysqlbinlog时,请注意文件系统有足够的空间容纳生成的文件。To configure the directory that mysqlbinlog uses for temporary files, use the TMPDIR environment variable.要配置mysqlbinlog用于临时文件的目录,请使用TMPDIR环境变量。

mysqlbinlog sets the value of pseudo_slave_mode to true before executing any SQL statements. mysqlbinlog在执行任何SQL语句之前将pseudo_slave_mode的值设置为trueThis system variable affects the handling of XA transactions, the original_commit_timestamp replication delay timestamp and the original_server_version system variable, and unsupported SQL modes.此系统变量影响XA事务的处理、original_commit_timestamp复制延迟时间戳和original_server_version系统变量,以及不支持的SQL模式。

mysqlbinlog supports the following options, which can be specified on the command line or in the [mysqlbinlog] and [client] groups of an option file. mysqlbinlog支持以下选项,可以在命令行或选项文件的[mysqlbinlog][client]组中指定。For information about option files used by MySQL programs, see Section 4.2.2.2, “Using Option Files”.有关MySQL程序使用的选项文件的信息,请参阅第4.2.2.2节,“使用选项文件”

Table 4.22 mysqlbinlog Options选项

Option Name选项名称Description描述Introduced引入版本Deprecated弃用版本
--base64-outputPrint binary log entries using base-64 encoding使用base-64编码打印二进制日志条目
--bind-addressUse specified network interface to connect to MySQL Server使用指定的网络接口连接MySQL服务器
--binlog-row-event-max-sizeBinary log max event size二进制日志最大事件大小
--character-sets-dirDirectory where character sets are installed安装字符集的目录
--compressCompress all information sent between client and server压缩客户端和服务器之间发送的所有信息8.0.178.0.18
--compression-algorithmsPermitted compression algorithms for connections to server服务器连接的允许压缩算法8.0.18
--connection-server-idUsed for testing and debugging. See text for applicable default values and other particulars用于测试和调试。有关适用的默认值和其他详细信息,请参阅文本
--databaseList entries for just this database仅列出此数据库的条目
--debugWrite debugging log写入调试日志
--debug-checkPrint debugging information when program exits程序退出时打印调试信息
--debug-infoPrint debugging information, memory, and CPU statistics when program exits程序退出时打印调试信息、内存和CPU统计信息
--default-authAuthentication plugin to use要使用的身份验证插件
--defaults-extra-fileRead named option file in addition to usual option files除了常规选项文件外,还读取命名选项文件
--defaults-fileRead only named option file只读命名选项文件
--defaults-group-suffixOption group suffix value选项组后缀值
--disable-log-binDisable binary logging禁用二进制日志记录
--exclude-gtidsDo not show any of the groups in the GTID set provided不显示提供的GTID集中的任何组
--force-if-openRead binary log files even if open or not closed properly即使打开或未正确关闭,也能读取二进制日志文件
--force-readIf mysqlbinlog reads a binary log event that it does not recognize, it prints a warning如果mysqlbinlog读取到它无法识别的二进制日志事件,它会打印一条警告
--get-server-public-keyRequest RSA public key from server从服务器请求RSA公钥
--helpDisplay help message and exit显示帮助消息并退出
--hexdumpDisplay a hex dump of the log in comments显示登录评论的十六进制转储
--hostHost on which MySQL server is locatedMySQL服务器所在的主机
--idempotentCause the server to use idempotent mode while processing binary log updates from this session only使服务器在仅处理来自此会话的二进制日志更新时使用幂等模式
--include-gtidsShow only the groups in the GTID set provided仅显示提供的GTID集中的组
--local-loadPrepare local temporary files for LOAD DATA in the specified directory在指定目录中为LOAD DATA准备本地临时文件
--login-pathRead login path options from .mylogin.cnf.mylogin.cnf读取登录路径选项
--no-defaultsRead no option files不读取选项文件
--offsetSkip the first N entries in the log跳过日志中的前N个条目
--passwordPassword to use when connecting to server连接到服务器时使用的密码
--plugin-dirDirectory where plugins are installed安装插件的目录
--portTCP/IP port number for connection用于连接的TCP/IP端口号
--print-defaultsPrint default options打印默认选项
--print-table-metadataPrint table metadata打印表元数据
--protocolTransport protocol to use要使用的传输协议
--rawWrite events in raw (binary) format to output files以原始(二进制)格式将事件写入输出文件
--read-from-remote-masterRead the binary log from a MySQL master rather than reading a local log file从MySQL主机读取二进制日志,而不是读取本地日志文件
--read-from-remote-serverRead binary log from MySQL server rather than local log file从MySQL服务器而不是本地日志文件读取二进制日志
--require-row-formatRequire row-based binary logging format需要基于行的二进制日志记录格式8.0.19
--result-fileDirect output to named file直接输出到指定文件
--rewrite-dbCreate rewrite rules for databases when playing back from logs written in row-based format. Can be used multiple times在播放以基于行的格式编写的日志时,为数据库创建重写规则。可多次使用
--server-idExtract only those events created by the server having the given server ID仅提取由具有给定服务器ID的服务器创建的事件
--server-id-bitsTell mysqlbinlog how to interpret server IDs in binary log when log was written by a mysqld having its server-id-bits set to less than the maximum; supported only by MySQL Cluster version of mysqlbinlog当日志是由服务器id位设置为小于最大值的mysqld写入时,告诉mysqlbinlog如何解释二进制日志中的服务器id;仅MySQL集群版本的mysqlbinlog支持
--server-public-key-pathPath name to file containing RSA public key包含RSA公钥的文件的路径名
--set-charsetAdd a SET NAMES charset_name statement to the output将SET NAMES charset_name语句添加到输出中
--shared-memory-base-nameShared-memory name for shared-memory connections (Windows only)共享内存连接的共享内存名称(仅限Windows)
--short-formDisplay only the statements contained in the log仅显示日志中包含的语句
--skip-gtidsDo not print any GTIDs; use this when writing a dump file from binary logs containing GTIDs不要打印任何GTID;在从包含GTID的二进制日志中写入转储文件时使用此选项
--socketUnix socket file or Windows named pipe to use要使用的Unix套接字文件或Windows命名管道
--ssl-caFile that contains list of trusted SSL Certificate Authorities包含受信任SSL证书颁发机构列表的文件
--ssl-capathDirectory that contains trusted SSL Certificate Authority certificate files包含受信任的SSL证书颁发机构证书文件的目录
--ssl-certFile that contains X.509 certificate包含X.509证书的文件
--ssl-cipherPermissible ciphers for connection encryption连接加密的允许密码
--ssl-crlFile that contains certificate revocation lists包含证书吊销列表的文件
--ssl-crlpathDirectory that contains certificate revocation-list files包含证书吊销列表文件的目录
--ssl-fips-modeWhether to enable FIPS mode on client side是否在客户端启用FIPS模式
--ssl-keyFile that contains X.509 key包含X.509密钥的文件
--ssl-modeDesired security state of connection to server与服务器连接的所需安全状态
--start-datetimeRead binary log from first event with timestamp equal to or later than datetime argument从时间戳等于或晚于datetime参数的第一个事件中读取二进制日志
--start-positionDecode binary log from first event with position equal to or greater than argument从位置等于或大于参数的第一个事件中解码二进制日志
--stop-datetimeStop reading binary log at first event with timestamp equal to or greater than datetime argument在时间戳等于或大于datetime参数的第一个事件时停止读取二进制日志
--stop-neverStay connected to server after reading last binary log file读取最后一个二进制日志文件后保持与服务器的连接
--stop-never-slave-server-idSlave server ID to report when connecting to server连接到服务器时要报告的从属服务器ID
--stop-positionStop decoding binary log at first event with position equal to or greater than argument在位置等于或大于参数的第一个事件时停止解码二进制日志
--tls-ciphersuitesPermissible TLSv1.3 ciphersuites for encrypted connections加密连接允许的TLSv1.3密码套件8.0.16
--tls-versionPermissible TLS protocols for encrypted connections加密连接的允许TLS协议
--to-last-logDo not stop at the end of requested binary log from a MySQL server, but rather continue printing to end of last binary log不要在MySQL服务器请求的二进制日志末尾停止,而是继续打印到最后一个二进制日志的末尾
--userMySQL user name to use when connecting to server连接到服务器时使用的MySQL用户名
--verboseReconstruct row events as SQL statements将行事件重建为SQL语句
--verify-binlog-checksumVerify checksums in binary log验证二进制日志中的校验和
--versionDisplay version information and exit显示版本信息并退出
--zstd-compression-levelCompression level for connections to server that use zstd compression使用zstd压缩的服务器连接的压缩级别8.0.18

You can pipe the output of mysqlbinlog into the mysql client to execute the events contained in the binary log. 您可以将mysqlbinlog的输出通过管道传输到mysql客户端,以执行二进制日志中包含的事件。This technique is used to recover from an unexpected exit when you have an old backup (see Section 7.5, “Point-in-Time (Incremental) Recovery”). For example:当您有旧备份时,此技术用于从意外退出中恢复(请参阅第7.5节,“时间点(增量)恢复”)。例如:

mysqlbinlog binlog.000001 | mysql -u root -p

Or:或者:

mysqlbinlog binlog.[0-9]* | mysql -u root -p

If the statements produced by mysqlbinlog may contain BLOB values, these may cause problems when mysql processes them. 如果mysqlbinlog生成的语句可能包含BLOB值,则mysql处理这些值时可能会导致问题。In this case, invoke mysql with the --binary-mode option.在这种情况下,使用--binary模式选项调用mysql

You can also redirect the output of mysqlbinlog to a text file instead, if you need to modify the statement log first (for example, to remove statements that you do not want to execute for some reason). 如果需要先修改语句日志(例如,删除因某种原因不想执行的语句),您还可以将mysqlbinlog的输出重定向到文本文件。After editing the file, execute the statements that it contains by using it as input to the mysql program:编辑文件后,将其用作mysql程序的输入,执行其中包含的语句:

mysqlbinlog binlog.000001 > tmpfile
... edit tmpfile ...
mysql -u root -p < tmpfile

When mysqlbinlog is invoked with the --start-position option, it displays only those events with an offset in the binary log greater than or equal to a given position (the given position must match the start of one event). 当使用--start-position选项调用mysqlbinlog时,它只显示二进制日志中偏移量大于或等于给定位置的事件(给定位置必须与一个事件的开始匹配)。It also has options to stop and start when it sees an event with a given date and time. 它还可以选择在看到具有给定日期和时间的事件时停止和启动。This enables you to perform point-in-time recovery using the --stop-datetime option (to be able to say, for example, roll forward my databases to how they were today at 10:30 a.m.).这使您能够使用--stop-datetime选项执行时间点恢复(例如,可以说“将我的数据库向前滚动到今天上午10:30的状态”)。

Processing multiple files.处理多个文件。  If you have more than one binary log to execute on the MySQL server, the safe method is to process them all using a single connection to the server. Here is an example that demonstrates what may be unsafe:如果你有多个二进制日志要在MySQL服务器上执行,安全的方法是使用到服务器的单个连接来处理它们。以下是一个示例,展示了可能存在的不安全因素:

mysqlbinlog binlog.000001 | mysql -u root -p # DANGER!!
mysqlbinlog binlog.000002 | mysql -u root -p # DANGER!!

Processing binary logs this way using multiple connections to the server causes problems if the first log file contains a CREATE TEMPORARY TABLE statement and the second log contains a statement that uses the temporary table. 如果第一个日志文件包含CREATE TEMPORARY TABLE语句,而第二个日志包含使用临时表的语句,则使用到服务器的多个连接以这种方式处理二进制日志会导致问题。When the first mysql process terminates, the server drops the temporary table. 当第一个mysql进程终止时,服务器会删除临时表。When the second mysql process attempts to use the table, the server reports unknown table.当第二个mysql进程尝试使用该表时,服务器会报告“未知表”

To avoid problems like this, use a single mysql process to execute the contents of all binary logs that you want to process. Here is one way to do so:为了避免此类问题,请使用单个mysql进程来执行要处理的所有二进制日志的内容。以下是一种方法:

mysqlbinlog binlog.000001 binlog.000002 | mysql -u root -p

Another approach is to write all the logs to a single file and then process the file:另一种方法是将所有日志写入一个文件,然后处理该文件:

mysqlbinlog binlog.000001 >  /tmp/statements.sql
mysqlbinlog binlog.000002 >> /tmp/statements.sql
mysql -u root -p -e "source /tmp/statements.sql"

From MySQL 8.0.12, you can also supply multiple binary log files to mysqlbinlog as streamed input using a shell pipe. 从MySQL 8.0.12开始,您还可以使用shell管道将多个二进制日志文件作为流式输入提供给mysqlbinlogAn archive of compressed binary log files can be decompressed and provided directly to mysqlbinlog. 压缩二进制日志文件的存档可以解压缩并直接提供给mysqlbinlogIn this example, binlog-files_1.gz contains multiple binary log files for processing. 在这个例子中,binlog-files_1.gz包含多个用于处理的二进制日志文件。The pipeline extracts the contents of binlog-files_1.gz, pipes the binary log files to mysqlbinlog as standard input, and pipes the output of mysqlbinlog into the mysql client for execution:管道提取binlog-files_1.gz的内容,将二进制日志文件作为标准输入传输到mysqlbinlog,并将mysqlbinlog的输出传输到mysql客户端执行:

gzip -cd binlog-files_1.gz | ./mysqlbinlog - | ./mysql -uroot  -p

You can specify more than one archive file, for example:您可以指定多个存档文件,例如:

gzip -cd binlog-files_1.gz binlog-files_2.gz | ./mysqlbinlog - | ./mysql -uroot  -p

For streamed input, do not use --stop-position, because mysqlbinlog cannot identify the last log file to apply this option.对于流式输入,不要使用--stop-position,因为mysqlbinlog无法识别应用此选项的最后一个日志文件。

LOAD DATA operations.操作。  mysqlbinlog can produce output that reproduces a LOAD DATA operation without the original data file. mysqlbinlog可以生成输出,在没有原始数据文件的情况下再现LOAD DATA操作。mysqlbinlog copies the data to a temporary file and writes a LOAD DATA LOCAL statement that refers to the file. mysqlbinlog将数据复制到临时文件中,并写入引用该文件的LOAD DATA LOCAL语句。The default location of the directory where these files are written is system-specific. 写入这些文件的目录的默认位置是特定于系统的。To specify a directory explicitly, use the --local-load option.要显式指定目录,请使用--local-load选项。

Because mysqlbinlog converts LOAD DATA statements to LOAD DATA LOCAL statements (that is, it adds LOCAL), both the client and the server that you use to process the statements must be configured with the LOCAL capability enabled. 因为mysqlbinlogLOAD DATA语句转换为LOAD DATA LOCAL语句(即,它添加了LOCAL),所以用于处理语句的客户端和服务器都必须配置为启用LOCAL功能。See Section 6.1.6, “Security Considerations for LOAD DATA LOCAL”.请参阅第6.1.6节,“本地加载数据的安全考虑”

Warning警告

The temporary files created for LOAD DATA LOCAL statements are not automatically deleted because they are needed until you actually execute those statements. LOAD DATA LOCAL语句创建的临时文件不会自动删除,因为在您实际执行这些语句之前需要它们。You should delete the temporary files yourself after you no longer need the statement log. The files can be found in the temporary file directory and have names like original_file_name-#-#.在不再需要语句日志后,您应该自己删除临时文件。这些文件可以在临时文件目录中找到,其名称类似于original_file_name-#-#

4.6.9.1 mysqlbinlog Hex Dump Format
4.6.9.2 mysqlbinlog Row Event Display
4.6.9.3 Using mysqlbinlog to Back Up Binary Log Files
4.6.9.4 Specifying the mysqlbinlog Server ID