Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   mysqlbinlog    ( 1 )

утилита для обработки двоичных файлов журналов (utility for processing binary log files)

  Name  |  Synopsis  |  Description  |    Mysqlbinlog hex dump format    |  Mysqlbinlog row event display  |  Note  |  See also  |

MYSQLBINLOG HEX DUMP FORMAT

The --hexdump option causes mysqlbinlog to produce a hex dump of the binary log contents:

shell> mysqlbinlog --hexdump master-bin.000001

The hex output consists of comment lines beginning with #, so the output might look like this for the preceding command:

/*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; # at 4 #051024 17:24:13 server id 1 end_log_pos 98 # Position Timestamp Type Master ID Size Master Pos Flags # 00000004 9d fc 5c 43 0f 01 00 00 00 5e 00 00 00 62 00 00 00 00 00 # 00000017 04 00 35 2e 30 2e 31 35 2d 64 65 62 75 67 2d 6c |..5.0.15.debug.l| # 00000027 6f 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |og..............| # 00000037 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| # 00000047 00 00 00 00 9d fc 5c 43 13 38 0d 00 08 00 12 00 |.......C.8......| # 00000057 04 04 04 04 12 00 00 4b 00 04 1a |.......K...| # Start: binlog v 4, server v 5.0.15-debug-log created 051024 17:24:13 # at startup ROLLBACK;

Hex dump output currently contains the elements in the following list. This format is subject to change. (For more information about binary log format, see http://forge.mysql.com/wiki/MySQL_Internals_Binary_Log .)

• Position: The byte position within the log file.

• Timestamp: The event timestamp. In the example shown, ´9d fc 5c 43´ is the representation of ´051024 17:24:13´ in hexadecimal.

• Type: The event type code. In the example shown, ´0f´ indicates a FORMAT_DESCRIPTION_EVENT. The following table lists the possible type codes.

┌─────┬──────────────────────────┬───────────────────────────┐ │Type │ Name │ Meaning │ ├─────┼──────────────────────────┼───────────────────────────┤ │00 │ UNKNOWN_EVENT │ This event should never │ │ │ │ be present in the log. │ ├─────┼──────────────────────────┼───────────────────────────┤ │01 │ START_EVENT_V3 │ This indicates the start │ │ │ │ of a log file written by │ │ │ │ MySQL 4 or earlier. │ ├─────┼──────────────────────────┼───────────────────────────┤ │02 │ QUERY_EVENT │ The most common type of │ │ │ │ events. These contain │ │ │ │ statements executed on │ │ │ │ the master. │ ├─────┼──────────────────────────┼───────────────────────────┤ │03 │ STOP_EVENT │ Indicates that master has │ │ │ │ stopped. │ ├─────┼──────────────────────────┼───────────────────────────┤ │04 │ ROTATE_EVENT │ Written when the master │ │ │ │ switches to a new log │ │ │ │ file. │ ├─────┼──────────────────────────┼───────────────────────────┤ │05 │ INTVAR_EVENT │ Used for AUTO_INCREMENT │ │ │ │ values or when the │ │ │ │ LAST_INSERT_ID() function │ │ │ │ is used in the statement. │ ├─────┼──────────────────────────┼───────────────────────────┤ │06 │ LOAD_EVENT │ Used for LOAD DATA INFILE │ │ │ │ in MySQL 3.23. │ ├─────┼──────────────────────────┼───────────────────────────┤ │07 │ SLAVE_EVENT │ Reserved for future use. │ ├─────┼──────────────────────────┼───────────────────────────┤ │08 │ CREATE_FILE_EVENT │ Used for LOAD DATA INFILE │ │ │ │ statements. This │ │ │ │ indicates the start of │ │ │ │ execution of such a │ │ │ │ statement. A temporary │ │ │ │ file is created on the │ │ │ │ slave. Used in MySQL 4 │ │ │ │ only. │ ├─────┼──────────────────────────┼───────────────────────────┤ │09 │ APPEND_BLOCK_EVENT │ Contains data for use in │ │ │ │ a LOAD DATA INFILE │ │ │ │ statement. The data is │ │ │ │ stored in the temporary │ │ │ │ file on the slave. │ ├─────┼──────────────────────────┼───────────────────────────┤ │0a │ EXEC_LOAD_EVENT │ Used for LOAD DATA INFILE │ │ │ │ statements. The contents │ │ │ │ of the temporary file is │ │ │ │ stored in the table on │ │ │ │ the slave. Used in MySQL │ │ │ │ 4 only. │ ├─────┼──────────────────────────┼───────────────────────────┤ │0b │ DELETE_FILE_EVENT │ Rollback of a LOAD DATA │ │ │ │ INFILE statement. The │ │ │ │ temporary file should be │ │ │ │ deleted on the slave. │ ├─────┼──────────────────────────┼───────────────────────────┤ │0c │ NEW_LOAD_EVENT │ Used for LOAD DATA INFILE │ │ │ │ in MySQL 4 and earlier. │ ├─────┼──────────────────────────┼───────────────────────────┤ │0d │ RAND_EVENT │ Used to send information │ │ │ │ about random values if │ │ │ │ the RAND() function is │ │ │ │ used in the statement. │ ├─────┼──────────────────────────┼───────────────────────────┤ │0e │ USER_VAR_EVENT │ Used to replicate user │ │ │ │ variables. │ ├─────┼──────────────────────────┼───────────────────────────┤ │0f │ FORMAT_DESCRIPTION_EVENT │ This indicates the start │ │ │ │ of a log file written by │ │ │ │ MySQL 5 or later. │ ├─────┼──────────────────────────┼───────────────────────────┤ │10 │ XID_EVENT │ Event indicating commit │ │ │ │ of an XA transaction. │ ├─────┼──────────────────────────┼───────────────────────────┤ │11 │ BEGIN_LOAD_QUERY_EVENT │ Used for LOAD DATA INFILE │ │ │ │ statements in MySQL 5 and │ │ │ │ later. │ ├─────┼──────────────────────────┼───────────────────────────┤ │12 │ EXECUTE_LOAD_QUERY_EVENT │ Used for LOAD DATA INFILE │ │ │ │ statements in MySQL 5 and │ │ │ │ later. │ ├─────┼──────────────────────────┼───────────────────────────┤ │13 │ TABLE_MAP_EVENT │ Information about a table │ │ │ │ definition. Used in MySQL │ │ │ │ 5.1.5 and later. │ ├─────┼──────────────────────────┼───────────────────────────┤ │14 │ PRE_GA_WRITE_ROWS_EVENT │ Row data for a single │ │ │ │ table that should be │ │ │ │ created. Used in MySQL │ │ │ │ 5.1.5 to 5.1.17. │ ├─────┼──────────────────────────┼───────────────────────────┤ │15 │ PRE_GA_UPDATE_ROWS_EVENT │ Row data for a single │ │ │ │ table that needs to be │ │ │ │ updated. Used in MySQL │ │ │ │ 5.1.5 to 5.1.17. │ ├─────┼──────────────────────────┼───────────────────────────┤ │16 │ PRE_GA_DELETE_ROWS_EVENT │ Row data for a single │ │ │ │ table that should be │ │ │ │ deleted. Used in MySQL │ │ │ │ 5.1.5 to 5.1.17. │ ├─────┼──────────────────────────┼───────────────────────────┤ │17 │ WRITE_ROWS_EVENT │ Row data for a single │ │ │ │ table that should be │ │ │ │ created. Used in MySQL │ │ │ │ 5.1.18 and later. │ ├─────┼──────────────────────────┼───────────────────────────┤ │18 │ UPDATE_ROWS_EVENT │ Row data for a single │ │ │ │ table that needs to be │ │ │ │ updated. Used in MySQL │ │ │ │ 5.1.18 and later. │ ├─────┼──────────────────────────┼───────────────────────────┤ │19 │ DELETE_ROWS_EVENT │ Row data for a single │ │ │ │ table that should be │ │ │ │ deleted. Used in MySQL │ │ │ │ 5.1.18 and later. │ ├─────┼──────────────────────────┼───────────────────────────┤ │1a │ INCIDENT_EVENT │ Something out of the │ │ │ │ ordinary happened. Added │ │ │ │ in MySQL 5.1.18. │ └─────┴──────────────────────────┴───────────────────────────┘

• Master ID: The server ID of the master that created the event.

• Size: The size in bytes of the event.

• Master Pos: The position of the next event in the original master log file.

• Flags: 16 flags. Currently, the following flags are used. The others are reserved for future use.

┌─────┬─────────────────────────────┬────────────────────────────┐ │Flag │ Name │ Meaning │ ├─────┼─────────────────────────────┼────────────────────────────┤ │01 │ LOG_EVENT_BINLOG_IN_USE_F │ Log file correctly │ │ │ │ closed. (Used only in │ │ │ │ FORMAT_DESCRIPTION_EVENT.) │ │ │ │ If this flag is set │ │ │ │ (if the flags are, for │ │ │ │ example, ´01 00´) in a │ │ │ │ FORMAT_DESCRIPTION_EVENT, │ │ │ │ the log file has not │ │ │ │ been properly closed. │ │ │ │ Most probably this is │ │ │ │ because of a master │ │ │ │ crash (for example, │ │ │ │ due to power failure). │ ├─────┼─────────────────────────────┼────────────────────────────┤ │02 │ │ Reserved for future use. │ ├─────┼─────────────────────────────┼────────────────────────────┤ │04 │ LOG_EVENT_THREAD_SPECIFIC_F │ Set if the event is │ │ │ │ dependent on the │ │ │ │ connection it was executed │ │ │ │ in (for example, ´04 00´), │ │ │ │ for example, if the event │ │ │ │ uses temporary tables. │ ├─────┼─────────────────────────────┼────────────────────────────┤ │08 │ LOG_EVENT_SUPPRESS_USE_F │ Set in some circumstances │ │ │ │ when the event is not │ │ │ │ dependent on the default │ │ │ │ database. │ └─────┴─────────────────────────────┴────────────────────────────┘