Redis monitoring data distribution tool Redis-audit usage Summary

Source: Internet
Author: User

Redis-audit is a script implemented in ruby. Through this script, we can know the memory usage of each type of key. It provides data such as the Access frequency of a type of key value, the expiration time, and the memory size of a type of key value, this makes it easy for us to find out which keys are not commonly used or are not used at all.

Better than Sentinel, Redis Live, Redis Faina, Redis-sampler, Redis-rdb-tools Monitoring or data distribution tools!

Download

Git clone https://github.com/snmaynard/redis-audit.git

After downloading, there are several files, including the ruby version of the file. The redis version may need to be adjusted according to the installed version:

Gemfile. lock README. md redis-audit.rb

It may involve installing some dependency packages.

Gem install bundle

Use

Bundle exec ruby redis-audit.rb [host] [port] [dbnum] [(optional) sample_size] For example:

Bundle exec ruby redis-audit.rb 127.0.0.1 6379 1 10000

10000 indicates the number of random keys. If the number of keys in the database is exceeded, all keys are traversed. If the number is smaller than 10000,100, the random number of keys may be repeated.

Output:

Analysis:

Monitored the execution of the script. In principle, requests are sent to redis,

1. First try to connect: "select" "1"

2. then obtain the number of keys: "dbsize"

3. If the input Sample Size is greater than the number of database keys, all keys are traversed, not randomly;

If the value is less than, the number of random samples is calculated based on the number of samples we have input. The random key is obtained: "randomkey"

4. Each key performs the following three steps, for example, the key is horse: 39:

4.1 "debug" "object" "horse: 39" this is used to calculate memory usage and idle time of keys.

4.2 "type" "horse: 39" is used to determine the type of the key value.

4.3 "ttl" "horse: 39" indicates the validity period of the key.

In this way, we can integrate other info data, slow log, and several clients. We can also use other languages to implement such monitoring scripts, such as the Popular html5 monitoring interface.

Recommended reading:

Use Shell and Redis to collect and analyze logs in cluster services in real time

Monitoring and Management of Server clusters through Redis Pub/Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.