redis监控工具redis live的安装

可以参考Redis live官方文档

http://www.nkrode.com/article/real-time-dashboard-for-redis

1.安装pip

wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate

  tar xf pip-1.5.4.tar.gz 

  cd pip-1.5.4

  python setup.py install

2.安装redis live依赖

安装依赖 tornado redis模块  python-dateutilargparsepython版本小于2.7就需要这个

 Install Dependencies

· tornado pip install tornado

· redis.py pip install redis

· python-dateutil pip install python-dateutil

You'll also need argparse if you're running Python < 2.7:

· argparse pip install argparse

3.安装redis live

wget https://codeload.github.com/nkrode/RedisLive/legacy.zip/master

解压到/application/tools

进入到解压目录下的src目录下

vim redis-live.conf 没有可以将src目录下的redis-live.conf.example 复制一份

{
    "RedisServers":
    [

//此处配置的是redis的地址及端口 多个可以按照下面的格式,{}添加
        {
            "server": "192.168.14.192",
            "port" : 6379
        }
    ],
                                                  
    "DataStoreType" : "sqlite",//172.16.0.70采用的是sqlite
     //如果DataStoreType是用redis 不是用  sqlite 就用配置     RedisStatsServer                                    
    "RedisStatsServer":
    {
        "server": "192.168.14.192",
        "port" : 6381
    },
 //如果DataStoreType不是用redis是用sqlite 就要配置SqliteStatsStore                                             
    "SqliteStatsStore":
    {
        "path": "/opt/portal/RedisLive/src/db/redislive.sqlite"
    }
}

 

RedisServers为你要监控的redis实例,可以添加多个
如果redis有密码,可以在实例配置中加入password选项;


DataStoreType决定使用那种类型的数据存储,(推荐用sqlite
如果是redis,使用RedisStatsServer作为数据存储的目标;(配置的redis 不要是被监控的,所以还是推荐用sqlite)
如果是sqlite,使用SqliteStatsStore作为数据存储的目标。


RedisStatsServer是用于存储RedisLive监控数据的redis实例,
if you don't have a spare redis instance to use to store RedisLive data, then you can configure RedisLive to use sqlite by changing to "DataStoreType" : "sqlite"


RedisLive的功能分两个部分:
一个部分是redis-server状态数据的采集,通过src/redis-monitor.py来执行;
另外一部分功能是提供对状态数据的查询服务,通过src/redis-live.py来提供web服务。

 

初始化DB必须的,否则报错

# cd db
# cat schema.sql | sqlite3 redislive.sqlite

后台启动

*/5 * * * * cd /application/tools/nkrode-RedisLive-6debcb4/src; ./redis-monitor.py --duration 20 >/dev/null 2>&1

nohup ./redis-live.py & >/dev/null 2>&1



猜你喜欢

转载自www.cnblogs.com/gdg87813/p/12275996.html