go-redis-parser(高效的Redis解析工具,支持查找大 key)

圖片描述

go-redis-parser,項目地址:https://github.com/8090Lamber... 一個簡單、安全的Redis 解析器。瞭解到目前存在的 parser,大部分都是單進程解析完成後,再統一輸出,拉長了總體的執行時間,決定本身重寫一個。它的特色是:離線即用,沒必要鏈接線上服務,而且利用 golang 語言自己的協程,實現邊解析邊寫文件內容,很是高效




簡單介紹下這個工具:git

Feature

支持Redis從2.8版本至5.0版本的,除了 module外的全部數據類型。包括:github

  • String
  • Hash
  • List
  • Set
  • SortedSed
  • Stream(敲黑板,重點重點重點,重要的事情說三遍)

Other

導出 server 全部 key/values,並且會找出現有各種型的 bigkey(相似redis-cli的 --bigkeys 參數輸出)golang

Installation

go-redis-parser 是可執行的二進制文件(binary file),能夠使用 git 或者 go get 來下載安裝redis

via git

$ git clone https://github.com/8090Lambert/go-redis-parser.git && cd go-redis-parser
$ go install

via go

$ go get github.com/8090Lambert/go-redis-parser

Using

在使用以前,你須要先設置 export PATH=$PATH:$GOPATH/binjson

$ go-redis-parser -rdb <dump.rdb> -o <gen-file folder> -type <gen-file type, json or csv, default csv>

Generate file

目前可導出兩種類型的文件:json、csv。這裏看下 csv 文件的示例
安全

BigKeys outputs

BigKeys的輸出示例:工具

# Scanning the rdb file to find biggest keys

-------- summary -------

Sampled 6 keys in the keyspace!
Total key length in bytes is 17

Biggest string found 's' has 1 bytes
Biggest   hash found 'h' has 1 fields
Biggest   list found 'li' has 2 items
Biggest sortedset found 'zset' has 2 members
Biggest    set found 'set' has 2 members
Biggest stream found 'stream' has 3 entries

1 string with 1 bytes
1 hash with 1 fields
1 list with 2 items
1 sortedset with 2 members
1 set with 2 members
1 stream with 3 entries
相關文章
相關標籤/搜索