Giter Site home page Giter Site logo

consul-snapshot-tool's Introduction

Consul Snapshot Inspection Tool

This is a quick and dirty tool for reading in a Consul snapshot file from the raft directory and dumping some statistics about which types of data are consuming the space.

It's fairly basic and quick and can certainly be made easier to use - PRs welcome. We may consider merging this into a more official tool or even the Consul binary if it proves useful.

Building

If you have a working Go toolchain you should be able to install this with:

$ go get -u github.com/banks/consul-snapshot-tool

If you want to cross compile it for Linux from another OS (e.g. so you can run the tool on a server where the snapshot file is without moving it or installing Go on the server):

  1. Checkout this repo into your $GOPATH. (Go modules may also work with go 1.12+, not tried yet).
  2. Compile with GOOS=linux go build .. Assuming your machine has same CPU architecture as the server - if not checkout another resource on cross-compiling Go, it's not hard!
  3. Copy the consul-snapshot-tool binary to the linux server and run it there.

Usage

There is only one way to use this and has no options currently. It reads from STDIN:

$ cat /tmp/consul/raft/sna....32/state.bin | consul-snapshot-tool
          Record Type    Count   Total Size
---------------------- -------- ------------
                  KVS     4294      489.7KB
             Register      104         57KB
            Tombstone      530       55.4KB
              Session       26        4.5KB
                Index        9         220B
            Autopilot        1         188B
CoordinateBatchUpdate        1         167B
---------------------- -------- ------------
                        TOTAL:      607.2KB

Backup Snapshots

To inspect a snapshot made using consul snapshot save you first need to extract the raw snapshot file. The snapshot is actually a zipped tar archive of the snapshot and some metadata.

$ tar -xzf backup.snap
$ cat state.bin | consul-snapshot-tool
           Record Type    Count   Total Size
---------------------- -------- ------------
                  KVS     4461      508.8KB
             Register      104         57KB
                Index        9         220B
            Autopilot        1         188B
CoordinateBatchUpdate        1         167B
---------------------- -------- ------------
                        TOTAL:      566.3KB

consul-snapshot-tool's People

Contributors

banks avatar roberteckert avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.