4.6.9.4 Specifying the mysqlbinlog Server ID指定mysqlbinlog服务器ID

When invoked with the --read-from-remote-server option, mysqlbinlog connects to a MySQL server, specifies a server ID to identify itself, and requests binary log files from the server. 当使用--read-from-remote-server选项调用时,mysqlbinlog会连接到MySQL服务器,指定一个服务器ID来标识自己,并从服务器请求二进制日志文件。You can use mysqlbinlog to request log files from a server in several ways:您可以使用mysqlbinlog以多种方式从服务器请求日志文件:

With --read-from-remote-server only, mysqlbinlog connects using a server ID of 0, which tells the server to disconnect after sending the last requested log file.只使用--read-from-remote-servermysqlbinlog使用服务器ID 0进行连接,该ID告诉服务器在发送最后一个请求的日志文件后断开连接。

With --read-from-remote-server and --stop-never, mysqlbinlog connects using a nonzero server ID, so the server does not disconnect after sending the last log file. 使用--read-from-remote-server--stop-nevermysqlbinlog使用非零的服务器ID进行连接,因此服务器在发送最后一个日志文件后不会断开连接。The server ID is 1 by default, but this can be changed with --connection-server-id.默认情况下,服务器ID为1,但可以使用--connection-server-id更改。

Thus, for the first two ways of requesting files, the server disconnects because mysqlbinlog specifies a server ID of 0. 因此,对于前两种请求文件的方式,服务器会断开连接,因为mysqlbinlog指定的服务器ID为0。It does not disconnect if --stop-never is given because mysqlbinlog specifies a nonzero server ID.如果不给出--stop-never,则不会断开连接,因为mysqlbinlog指定了非零的服务器ID。