RDBParser 0.7.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package RDBParser --version 0.7.1                
NuGet\Install-Package RDBParser -Version 0.7.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RDBParser" Version="0.7.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RDBParser --version 0.7.1                
#r "nuget: RDBParser, 0.7.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RDBParser as a Cake Addin
#addin nuget:?package=RDBParser&version=0.7.1

// Install RDBParser as a Cake Tool
#tool nuget:?package=RDBParser&version=0.7.1                

rdb-tools

rdb-tools is a tool to parse/analysis redis rdb files that is implemented by csharp.

This repository is inspired by redis-rdb-tools and rdr.

It consists of two parts:

  • A parser library, that you can customize by yourself.
  • An anslysis cli tool, that your can ans some basic usages for command line.

rdb-cli

Install

  1. Download the package from the latest stable release.
  2. dotnet tool install --global rdb-cli

Usage

Show help information:

[~] ./rdb-cli -h      
Description:
  rdb-cli is a command line tool, analysis redis rdb files.

Usage:
  rdb-cli [command] [options]

Options:
  -?, -h, --help  Show help and usage information
  -v, --version   Show version information

Commands:
  keys <file>    Get all keys from rdb files
  memory <file>  Get memory info from rdb files

The usage of memory is as follow:

[~] ./rdb-cli memory -h
Description:
  Analysis memory info from rdb files

Usage:
  rdb-cli memory <file> [options]

Arguments:
  <file>  The path of rdb file.

Options:
  -o, --output <output>                                  The output path of parsing result.
  -ot, --output-type <html|json>                         The output type of parsing result. [default: json]
  -tp, --top-prefixes <top-prefixes>                     The number of top key prefixes. [default: 50]
  -tb, --top-bigkeys <top-bigkeys>                       The number of top big keys. [default: 50]
  --db <db>                                              The filter of redis databases.
  --type <hash|list|module|set|sortedset|stream|string>  The filter of redis types.
  -?, -h, --help                                         Show help and usage information
[~] ./rdb-cli memory /tmp/demo.rdb -ot html -tb 200

Prepare to parse [/tmp/demo.rdb]
Please wait for a moment...

parse cost: 22449ms
total cost: 23107ms
result path: /tmp/res.html

Sample html result is as follow:

alternate text is missing from this package README image

Sample json result is as follow:

{
    "usedMem": 2373094496,
    "cTime": 0,
    "count": 7615333,
    "rdbVer": 9,
    "redisVer": "5.2.0",
    "redisBits": 0,
    "typeRecords": [
        {
            "Type": "sortedset",
            "Bytes": 1385664695,
            "Num": 6212084
        }
    ],
    "largestRecords": [
        {
            "Database": 2,
            "Key": "key",
            "Bytes": 10340,
            "Type": "string",
            "Encoding": "string",
            "Expiry": 0,
            "NumOfElem": 8318,
            "LenOfLargestElem": 0,
            "FieldOfLargestElem": null
        }
    ],
    "expiryInfo": [
        {
            "Expiry": "0~1h",
            "Bytes": 986801692,
            "Num": 4345021
        }
    ],
     "functions": [
        {
            "Engine": "lua",
            "LibraryName": "mylib"
        }
    ],
    "largestStreams": [
        {
            "Key": "key",
            "Length": 5,
            "LastId": "1650158935767-0",
            "FirstId": "1650158906951-0",
            "MaxDeletedEntryId": "0-0",
            "EntriesAdded": 5,
            "CGroups": 0
        }
    ]
}

RDBParse

Install

dotnet add package RDBParse

Usage

  1. Implement your own IReaderCallback
  2. Create a new instance of BinaryReaderRDBParser
  3. Call Parse method of BinaryReaderRDBParser instance

Following this below code for example.

public class MyReaderCallBack : IReaderCallback
{
}
var path = "/yourpath/your.rdb"
var cb = new MyReaderCallBack();
var parser = new RDBParser.BinaryReaderRDBParser(cb);
parser.Parse(path);

To contribute

Contributions are welcome!

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.9.5 479 8/27/2024
0.9.4 128 8/19/2024
0.9.3 97 7/13/2024
0.9.2 97 6/30/2024
0.9.1 110 4/29/2024
0.9.0 97 4/28/2024
0.7.1 141 4/14/2024
0.7.0 117 4/7/2024
0.6.0 384 2/24/2023
0.5.0 335 1/25/2023
0.4.0 423 10/11/2022
0.3.0 473 4/17/2022
0.2.0 469 4/14/2022
0.1.0 449 4/4/2022