Giter Site home page Giter Site logo

redis_scanner's Introduction

RedisScanner Build Status

RedisScanner is a tiny tool for scanning all redis keys and creating statistic result. The features are the followings.

  • Scans keys using scan replacing keys command.
  • Creates statistic result by key's pattern.
  • Provide key's detail information which includes type and size.
  • Provide table format output..

Installation

Install redis_scanner in shell.

gem install redis_scanner

Installation prerequirement

You should install ruby first.

Usage

  • Get started

You can run it directly after install. It will scan local redis instance when you just input redis_scanner.

redis_scanner

The Output is like this:

+------------------------------------+-------+
| Key                                | Count |
+------------------------------------+-------+
| demo:user:<id>:counter             | 10000 |
| u:<uuid>:pf                        |    52 |
| sidekiq_demo:stat:failed:<date>    |     4 |
| sidekiq_demo:stat:processed:<date> |     4 |
| _sp_one:queue:default              |     1 |
| bh:queues                          |     1 |
...
+------------------------------------+-------+
redis_scanner -d -l 10

The Output is like this:

+------------------------------------+--------+-------+--------+---------+
| Key                                | Type   | Count | Size   | AvgSize |
+------------------------------------+--------+-------+--------+---------+
| demo:user:<id>:counter             | string | 10000 | 927510 |   92.75 |
| u:<uuid>:pf                        | hash   |    52 |    108 |    2.08 |
| sidekiq_demo:stat:failed:<date>    | string |     4 |      5 |    1.25 |
| sidekiq_demo:stat:processed:<date> | string |     4 |      6 |     1.5 |
| _sp_one:queue:default              | list   |     1 |      1 |     1.0 |
| bh:queues                          | set    |     1 |      1 |     1.0 |
| bh:retry                           | zset   |     1 |      1 |     1.0 |
| bh:stat:failed                     | string |     1 |      1 |     1.0 |
| bh:stat:processed                  | string |     1 |      1 |     1.0 |
| bus_app:app_two                    | hash   |     1 |      1 |     1.0 |
+------------------------------------+--------+-------+--------+---------+
  • Scan keys with some pattern
redis_scanner -m u:*
  • Output statistic result to a file
redis_scanner -f keys_stat.txt
  • Redis options. The options are same of redis-cli.
redis_scanner -h <host> -p <port> ...

Development

You are free to modify it for your need.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/xiewenwei/redis_scanner. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

redis_scanner's People

Contributors

xiewenwei avatar

Stargazers

 avatar junwei avatar  avatar 1ronman28 avatar toaco avatar  avatar  avatar liyijie avatar mention88 avatar Cheung avatar Ethan.well avatar  avatar Qiang avatar Aaron Brady avatar Fly Chang avatar Nami W avatar Felix  avatar  avatar xiajian avatar Jason Hou avatar liming avatar Larry Zhao avatar guangjian avatar FrancisTao avatar Silas Ribas Martins avatar Gowoon Lee avatar Rob avatar tudouya avatar Hadi avatar Jack Hu avatar star avatar oyjing avatar Rohit Trivedi avatar Dmitry Polushkin avatar Jérôme Foray avatar Timur Yanberdin avatar Semyon Pupkov avatar Anton Davydov avatar Avldya avatar Julian Pokrovsky avatar Stanislav (Stas) Katkov avatar Yury Druzhkov avatar Andrei Horak avatar Nantiwat Thongseng avatar david terranova avatar  avatar Kitsion avatar Lvmoy avatar Yunzheng avatar  avatar tom.wen avatar Craig Sheen avatar liuwenxue avatar Howard Jegado avatar 周丰 avatar guanweijia avatar wikimo avatar  avatar FlamingTree avatar  avatar Liang avatar ycwei avatar aaron avatar liujianhei avatar heyen avatar  avatar raecoo avatar Jimmy avatar bscd avatar  avatar Manuel Meurer avatar Diego Rodriguez avatar  avatar Swaathi Kakarla avatar 唐睿 avatar Francois-Guillaume Ribreau avatar yafei lee avatar zhouguangming avatar  avatar stormzhang avatar SkyKai avatar Yoichi Dan avatar MingyuanQin avatar  avatar

Watchers

 avatar James Cloos avatar

Forkers

geeker4py linlams

redis_scanner's Issues

invalid byte sequence in US-ASCII

.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/rule.rb:18:in match': invalid byte sequence in US-ASCII (ArgumentError)・・・・・・・・・・・・・・・・・・・・・ 0% Keys from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/rule.rb:18:inblock in extract_pattern'
from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/rule.rb:17:in each' from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/rule.rb:17:inextract_pattern'
from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/engine.rb:42:in block in scan' from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/engine.rb:41:ineach'
from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/engine.rb:41:in scan' from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner/engine.rb:12:inrun'
from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/lib/redis_scanner.rb:13:in scan' from /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/redis_scanner-0.1.4/bin/redis_scanner:64:in<top (required)>'
from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/redis_scanner:23:in load' from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/redis_scanner:23:in

'
from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in eval' from /home/ec2-user/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in'

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.