美文网首页
使用Redis Live监控Redis服务器

使用Redis Live监控Redis服务器

作者: 十毛tenmao | 来源:发表于2019-05-30 18:11 被阅读0次

Redis服务器运行时,即使服务正常,我们也需要连接Redis服务期间的情况,比如内存消耗,命令处理等指标。Redis Live是开源的Redis监控套件,包含监控与Web服务。

安装

# 安装依赖
pip install tornado
pip install redis
pip install python-dateutil

# 下载RedisLive
wget https://github.com/kumarnitin/RedisLive/zipball/master -O RedisLive.zip
unzip RedisLive.zip
mv nkrode-RedisLive-e1d7763 RedisLive

配置

  • 准备配置文件
cd RedisLive/src
mv redis-live.conf.example redis-live.conf
  • 修改配置文件

redis-live.conf

{
    "RedisServers": [
        {
            "server": "192.168.58.100",
            "port": 6379,
            "password": "tenmaopass"
        },
        {
            "server": "192.168.58.101",
            "port": 6379,
            "password": "tenmaopass"
        }
    ],
    "DataStoreType": "sqlite",
    "SqliteStatsStore": {
        "path": "/home/tenmao/RedisLive/src/db/redislive.sqlite"
    }
}

这里使用sqlite作为数据库,而不是使用另外一个redis,以免容易弄混淆

启动

  • 启动监控脚本
./redis-monitor.py --duration=120
  • 启动Web服务器
./redis-live.py
  • 打开监控页面

http://localhost:8888/index.html

RedisLive页面

注意事项

因为redis-monitor.py执行中会影响Redis的吞吐率,所以需要根据实际情况调整参数--duration

常见问题

  • redis-monitor.py --duration=120启动失败,其中错误信息包含return json.load(config)。一般是因为redis-live.conf配置错误,不是一个合法的JSON格式

参考

相关文章

网友评论

      本文标题:使用Redis Live监控Redis服务器

      本文链接:https://www.haomeiwen.com/subject/kdxbtctx.html