How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog Como ler o MySQL Log Binário Files (BinLog) com mysqlbinlog

MySQL database server generates binary log files for every transaction to the databases, provided administrator does not disable or comment out the “log-bin” parameter in my.cny configuration file. Banco de dados MySQL binary gera arquivos de log de cada operação para os bancos de dados, desde administrador não desativar ou comentar as "log-bin" parâmetro my.cny no arquivo de configuração. The binary log files are written in binary format. O log binário arquivos são escritos em formato binário. Although the binary logs, or also known as logbin are mainly used for MySQL database replication purpose, sometimes you may need to examine or read the contents of binary logs in text format, where the mysqlbinlog utility will come in handy. Embora os logs binários, ou também conhecido como logbin são usadas principalmente para a replicação de dados MySQL efeito, às vezes pode ser necessário estudar ou ler o conteúdo dos logs binários em formato de texto, onde o utilitário mysqlbinlog será útil.

Binary log file, which normally has name with the format host_name-bin.xxxxxx and store in /var/lib/mysql directory, could not be opened and read straight away as it’s in unreadable binary format. Binário arquivo de registro, que normalmente tem nome com o formato host_name-bin.xxxxxx e armazenar em / var / lib / mysql diretório, não poderiam ser abertos e lidos imediatamente como ele é ilegível, em formato binário. To read the binary logs in text format, we can make use of mysqlbinlog command, which also able to readrelay log files written by a slave server in a replication setup. Para ler os logs binários em formato de texto, podemos fazer uso do comando mysqlbinlog, que também capaz de readrelay arquivos de registro escrito por um servidor em uma replicação slave setup. Relay logs have the same format as binary log files. Relay logs têm o mesmo formato binário arquivos de log.

To use mysqlbinlog utility is simple, simply use the following command syntax to invoke mysqlbinlog after login in as root (else you have to specify user name and password) to shell via SSH: Para usar o utilitário mysqlbinlog é simples, basta utilizar o seguinte comando sintaxe para invocar mysqlbinlog após login como root (senão você tem que especificar o nome do usuário e senha) para a casca via SSH:

mysqlbinlog [options] log_file … mysqlbinlog [opções] log_file…

So to read and display the contents of the binary log file named binlog.000001, use this command: Então, para ler e exibir o conteúdo do log binário arquivo chamado binlog.000001, use este comando:

mysqlbinlog binlog.000001 mysqlbinlog binlog.000001

The binary log files and its data are likely to be very huge, thus making it almost impossible to read anything on screen. O log binário seus arquivos e dados são susceptíveis de ser muito grande, tornando assim quase impossível de ler nada na tela. However, you can pipe the output of mysqlbinlog into a file which can be open up for later browsing in text editor, by using the following command: No entanto, você pode canalização para a saída do mysqlbinlog em um arquivo que pode ser aberto até mais tarde para navegar no editor de texto, utilizando o seguinte comando:

mysqlbinlog binlog.000001 > filename.txt mysqlbinlog binlog.000001> filename.txt

To reduce the amount of data retrieved from binary logs, there are several options that can be used to limit the data that is been returned. Para reduzir a quantidade de dados extraídos de logs binários, existem várias opções que podem ser utilizadas para limitar os dados que tem sido devolvidos. Among the useful ones are listed below: Entre os mais úteis são listados a seguir:

–start-datetime=datetime - Start-datetime = datetime

Start reading the binary log at the first event having a timestamp equal to or later than the datetime argument. Começar a ler o log binário no primeiro evento com uma hora mais tarde do que igual ou datetime o argumento. The datetime value is relative to the local time zone on the machine where you run mysqlbinlog. O valor datetime é relativo ao fuso horário local na máquina onde é executado mysqlbinlog. The value should be in a format accepted for the DATETIME or TIMESTAMP data types. O valor deve ser aceito em um formato DATETIME ou TIMESTAMP para os tipos de dados. For example: Por exemplo:

mysqlbinlog --start-datetime="2005-12-25 11:25:56" binlog.000001 mysqlbinlog - start-datetime = "2005-12-25 11:25:56" binlog.000001

–stop-datetime=datetime - Stop-datetime = datetime

Stop reading the binary log at the first event having a timestamp equal or posterior to the datetime argument. Parar a leitura do log binário ao primeiro evento ter um timestamp igual ou posterior à datetime argumento. This option is useful for point-in-time recovery. Esta opção é útil para ponto-in-time recuperação. See the description of the –start-datetime option for information about the datetime value. Consulte a descrição do-start-datetime opção para obter informações sobre o valor datetime.

–start-position=N - Start-posição N =

Start reading the binary log at the first event having a position equal to the N argument. Iniciar a leitura do log binário ao primeiro evento tendo uma posição igual à N argumento. This option applies to the first log file named on the command line. Esta opção aplica-se ao primeiro log arquivo chamado na linha de comando.

–stop-position=N - Stop-posição N =

Stop reading the binary log at the first event having a position equal or greater than the N argument. Parar a leitura do log binário ao primeiro evento tendo uma posição igual ou maior do que o N argumento. This option applies to the last log file named on the command line. Esta opção aplica-se ao último log arquivo chamado na linha de comando.

For more usage information on mysqlbinlog, visit Para obter mais informações sobre a utilização mysqlbinlog, visite here aqui .

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Esta é uma página traduzida máquina que é fornecida "como está" sem garantia. Machine translation may be difficult to understand. A tradução automática pode ser difícil de compreender. Please refer to Por favor, consulte a original English article Inglês original article whenever possible. sempre que possível.

Share and contribute or get technical support and help at Compartilhe e contribuir ou obter suporte técnico e ajudar a My Digital Life Forums Minha vida digital Fóruns .



One Response to “How to Read MySQL Binary Log Files (BinLog) with mysqlbinlog” Uma resposta a "How to Read Log Binário MySQL Files (BinLog) com mysqlbinlog"

  1. Pisu
    June 29th, 2008 16:33 29 de junho de 2008 16:33
    1

    This post saved my life today… when the binary log were the only way to retrieve important data get lost… thanks!! Este post salvou minha vida hoje… quando o log binário foi a única maneira de recuperar dados importantes se perdem… agradece!

Leave a Reply Deixe uma resposta

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Você pode usar estas tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe without commenting Subscreva sem comentar


Custom Search

New Articles Novos Artigos

Incoming Search Terms for the Article Incoming Termos de pesquisa para o artigo

mysqlbinlog mysqlbinlog - -- BINLOG BINLOG - -- mysql logs MySQL logs - -- mysql binary log MySQL log binário - -- mysql binlogs MySQL binlogs - -- read mysql logs leia MySQL logs - -- read mysql log leia MySQL log - -- mysql log file MySQL arquivo log - -- mysql log reader MySQL log leitor - -- mysql log files MySQL arquivos log - -- reading mysql logs leitura MySQL logs - -- mysql binary logs MySQL binary logs - -- how to read mysql log a ler o MySQL log - -- mysql read bin log MySQL leia bin log - -- mysql log read MySQL log lidas - -- mysql binary log reader MySQL log binário leitor - -- mysql binlog format MySQL binlog formato - -- mysql binlog MySQL binlog - -- mysql read log MySQL ler log - -- mysql bin log MySQL bin log - -- mysql bin log reader MySQL bin log leitor - -- mysql binary log files MySQL binary log files - -- binlog mysql binlog MySQL - -- mysql binlog reader MySQL binlog leitor - -- mysqlbinlog example mysqlbinlog exemplo - -- read mysql bin log leia MySQL bin log - -- binary log log binário - -- read binlog leia binlog - -- mysql binary logging MySQL binary log - -- mysql log format MySQL formato de registro - -- mysqlbinlog usage mysqlbinlog uso - -- reading mysql bin logs leitura MySQL bin logs - -- mysql binary log format MySQL log binário formato - -- mysql bin log export MySQL bin log exportação - -- binlogs in mysql binlogs no MySQL - -- mysqlbinlog mysqlbinlog - -- mysql binary MySQL binary - -- how to read mysql bin log a ler mysql bin log - -- mysql logging MySQL madeireira - -- mysql binary log location MySQL binary log local - -- mysql log files windows MySQL arquivos de registro do Windows - -- how to read mysql binary log a ler mysql log binário - -- mysql read logs MySQL ler logs - -- how to read mysql log file a ler mysql arquivo log - -- how to read mysql binary logs a ler mysql logs binários - -- tool read mysql binlog file leia ferramenta MySQL binlog arquivo - -- mysqlbinlog windows mysqlbinlog Windows - -- logs mysql logs MySQL - -- change binlog position mudança binlog posição - -- mysql bin MySQL bin - --