File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,3 +59,12 @@ lightning 还支持直接分析加密的 binlog,只需要添加 `-keyring` 配
5959# 回滚所有删除事件
6060lightning -plugin flashback -keyring keyring -event-types delete binlog.encrypted
6161```
62+
63+ ## 从标准输入读取 binlog
64+
65+ 有时候需要分析的 binlog 并不在本机,可能存储在 s3 或其他服务器上。分析远程 binlog 文件时不想占用本地磁盘空间可以选择从标准输入读取 binlog。添加 ` - ` 表示从标准输入读取文件内容,示例如下:
66+
67+ ``` bash
68+ # 仅以 binlog 文件存储在 minio 为例,使用 minio client 读取远程经过压缩的 binlog 文件
69+ mc cat path/to/binlog_file.gz | gunzip | ./lightning - > decrypt_log.sql
70+ ```
Original file line number Diff line number Diff line change @@ -189,7 +189,14 @@ func CheckBinlogFileTime(files []string) error {
189189// BinlogFileParser parser binary log file
190190func BinlogFileParser (files []string ) error {
191191 for _ , filename := range files {
192- fd , err := os .Open (filename )
192+ var fd * os.File
193+ var err error
194+ switch filename {
195+ case "-" :
196+ fd = os .Stdin
197+ default :
198+ fd , err = os .Open (filename )
199+ }
193200 if err != nil {
194201 return err
195202 }
You can’t perform that action at this time.
0 commit comments