1. 程式人生 > >Redis叢集監控工具之RedisLive

Redis叢集監控工具之RedisLive

這裡將介紹下redis叢集監控UI工具之RedisLive的安裝部署。
說白了,RedisLive就是一款免費開源的基於Python、tornado的的reids的監控工具,以WEB的形式展現出redis中的記憶體、key,例項資料等資訊!RedisLive官網

安裝Python

因為RedisLive是基於Python的,所以機器必須先安裝Python,可輸入Python來監測機器是否安裝Python,如下則說明已經安裝OK,否則需要安裝(此過程可谷歌,這裡不贅述)。

[root@spg sbin]# python
Python 2.7.5 (default, Jun 17
2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>

安裝tornado等

RedisLive是WEB監控介面,所以需要WEB容器,這裡需要使用的是tornado,可使用如下方式快速安裝。

[root@spg sbin]# pip install tornado

此時可能報錯,提示pip未安裝,則需要安裝pip。
具體可參考:https://pip.pypa.io/en/stable/installing/


pip安裝成功後,繼續安裝tornado、redis、python-dateutil

[root@spg sbin]# pip install tornado
[root@spg sbin]# pip install redis
[root@spg sbin]# pip install python-dateutil

如果Python版本小於2.7,則還需要安裝argparse

[root@spg sbin]# pip install argparse

安裝RedisL

[root@spg sbin]# git clone https://github.com/kumarnitin/RedisLive.git

配置RedisLive

進入src,複製redis-live.conf.example,改為redis-live.conf

{
    "RedisServers":
    [
        {
            "server": "localhost",
            "port" : 6380
        },
        {
            "server": "localhost",
            "port" : 6381
        },
        {
            "server": "localhost",
            "port": 6382
        }
    ],
    "DataStoreType" : "redis",
    "RedisStatsServer":
    {
        "server" : "localhost",
        "port" : 6383
    },
    "SqliteStatsStore" :
    {
        "path":  "to your sql lite file"
    }
}

配置說明:

在RedisServers中設定需要監控的redis-server;
DataStoreType決定使用那種型別的資料儲存,
如果是redis,使用RedisStatsServer作為資料儲存的目標;
如果是sqlite,使用SqliteStatsStore作為資料儲存的目標。

啟動RedisLive

RedisLive分為兩部分,其中一部分為監控指令碼,另一部分為web服務,所以需要分別啟動。

[root@spg sbin]# ./redis-monitor.py --duration=120
[root@spg sbin]# ./redis-live.py

使用–duration來指定多長時間去取一次reids的資料