Redis監控工具-Redis-Stat、RedisLive 一點課堂(多岸學院)

Redis監控工具-Redis-Stat、RedisLive

Redis-stat(Ruby)和Redis Live(python)是兩款Redis監控工具,下面將介紹如何安裝部署這兩個工具,監控Redis運行狀況html

測試環境:

Ubuntu 14.04 LTS x64
Redis redis-3.0.7.tar.gz
Ruby ruby 1.9.3
Python 2.7.6

Redis 安裝

Redis安裝請參照:Redis安裝與配置python

Redis-stat 安裝部署

redis-stat is a simple Redis monitoring tool written in Ruby.git

It is based on INFO command of Redis, and thus generally won’t affect the performance of the Redis instance unlike the other monitoring tools based on MONITOR command.github

redis-stat allows you to monitor Redis instancesweb

  • either with vmstat-like output from the terminal
  • or with the dashboard page served by its embedded web server.
  • 一般來講,不會像基於MONITOR命令的監控工具同樣,對Redis自己有性能上的影響

Github地址redis

卸載原有Ruby

sudo apt-get autoremove --purge ruby*

安裝Ruby

sudo apt-get install ruby-full

安裝Redis-stat

gem install redis-stat

基本使用

  1. redis-stat命令參數sql

    usage: redis-stat [HOST[:PORT] ...] [INTERVAL [COUNT]]vim

    -a, --auth=PASSWORD             設置密碼
    -v, --verbose                   顯示更多信息
        --style=STYLE               輸出編碼類型: unicode|ascii
        --no-color                  取消ANSI顏色編碼
        --csv=OUTPUT_CSV_FILE_PATH  以CSV格式存儲結果
        --es=ELASTICSEARCH_URL      把結果發送到 ElasticSearch: [http://]HOST[:PORT][/INDEX]
    
        --server[=PORT]             運行redis-stat的web server (默認端口號: 63790)
        --daemon                    使得redis-stat成爲進程。必須使用 --server 選項
    
        --version                   顯示版本號
        --help                      顯示幫助信息
  2. redis-stat運行命令行監控 redis-stat redis-stat 1 redis-stat 1 10 redis-stat --verbose redis-stat localhost:6380 1 10 redis-stat localhost localhost:6380 localhost:6381 5 redis-stat localhost localhost:6380 1 10 --csv=/tmp/outpu.csv --verbose瀏覽器

  3. Server端運行界面ruby

  1. Web界面中的redis-stat

當設置–server選項以後,redis-stat會在後臺啓動一個嵌入式的web server(默認端口號:63790),能夠讓你在瀏覽器中監控Redis

redis-stat --server
redis-stat --verbose --server=8080 5

# redis-stat server can be daemonized
redis-stat --server --daemon

# Kill the daemon
killall -9 redis-stat-daemon
  1. Web端運行界面

而後在你的瀏覽器中輸入:

http://你的Redis IP:63790

RedisLive 安裝部署

Redis Live is a dashboard application with a number of useful widgets. At it’s heart is a monitoring script that periodically issues INFO and MONITOR command to the redis instances and stores the data for analytics.

長時間運行對Redis性能有所影響

Github地址

Real time dashboard for redis

安裝運行依賴

  1. tornado pip install tornado
  2. redis.py pip install redis
  3. python-dateutil pip install python-dateutil

下載RedisLive

git clone https://github.com/kumarnitin/RedisLive.git

conf配置

進入src目錄

cp redis-live.conf.example ./redis-live.conf

vim redis-live.conf

{  
    "RedisServers":  
    [   
            {  
              "server" : "你的Redis IP地址",  
              "port"  : 6379  
            }
            ........
            能夠多個
    ],
"DataStoreType" : "redis",  
 
    "RedisStatsServer":  
    {  
            "server" : "你的Redis 監控IP地址",  
            "port" : 6379  
    },
    
    "SqliteStatsStore" :
    {
            "path":  "to your sql lite file"
    }
}

其中RedisServers爲你要監控的redis實例,能夠添加多個,RedisStatsServer是存儲RedisLive監控數據的實例,若是redis有密碼,能夠在實例配置中加入password選項;若是沒有存儲RedisLive數據的實例,須要將DataStoreType改爲」DataStoreType」 : 「sqlite」這種設置

啓動RedisLive

  1. 啓動監控腳本,監控120秒,duration參數是以秒爲單位

    sudo ./redis-monitor.py --duration=120

  2. 啓動webserver。

RedisLive使用tornado做爲web服務器,因此不須要單獨安裝服務器

Tornado web server 是使用Python編寫出來的一個極輕量級、高可伸縮性和非阻塞IO的Web服務器軟件

sudo ./redis-live.py

Web運行界面

而後在你的瀏覽器中輸入:

http://你的Redis IP:8888/index.html

file

本文來自http://wxmimperio.tk/2016/02/25/Redis-Monitor-Tools/ 在這裏插入圖片描述 QQ討論羣組:984370849 706564342 歡迎加入討論

想要深刻學習的同窗們能夠加入QQ羣討論,有全套資源分享,經驗探討,沒錯,咱們等着你,分享互相的故事! 在這裏插入圖片描述

相關文章
相關標籤/搜索