RedisLive安装指南

news/2025/3/17 21:00:22/

引言:Redis是目前最为流行的缓存服务,本文将详细介绍如何搭建RedisLive的监控环境。本文安装之后的功能仍不完整,无实时的数据显示。


1. 环境介绍

  Centos 4.7.4, Python 2.6.6,

  检查环境信息, 打开命令行:

[abcd@ZC_VM_10_100_138_xx ~]$ cat /proc/version
Linux version 2.6.32-431.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UTC 2013

 检查Linux下的Python版本:

[abcd@ZC_VM_10_100_138_xx redismonitor]$ python 
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
由此可以目前基本的环境信息。

2.  Redis Live介绍

  项目主页地址: https://github.com/nkrode/RedisLive

   功能强大,界面直观,非常的好用,同时可以支持多个Redis实例的监控。

3.  Python Pip的安装

  pip是Python中的包管理工具,这里首先确认其是否已经安装,如未安装,则优先安装。先下载安装文件。

[abcd@ZC_VM_10_100_138_xx redismonitor]$ wget https://bootstrap.pypa.io/get-pip.py
--2016-09-27 14:22:32--  https://bootstrap.pypa.io/get-pip.py
正在解析主机 bootstrap.pypa.io... 151.101.16.175
正在连接 bootstrap.pypa.io|151.101.16.175|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1524722 (1.5M) [text/x-python]
正在保存至: “get-pip.py”20% [======================================>                                                                                                                                                             ] 310,803      101K/s eta(英国中部时22% [===========================================>                                                                                                                                                        ] 343,571      102K/s eta(英国中部时24% [===============================================>                                                                                                                                                    ] 376,339      103K/s eta(英国中部时25% [=================================================>                                                                                                                                                  ] 392,723     99.4K/s eta(英国中部时27% [=====================================================>                                                                                                                                              ] 425,491      101K/s eta(英国中部时28% [=======================================================>                                                                                                                                            ] 441,875     98.0K/s eta(英国中部时30% [=========================================================>                                                                                                                                          ] 458,259     96.2K/s eta(英国中部时32% [==============================================================>                                                                                                                                     ] 491,027     96.7K/s eta(英国中部时33% [================================================================>                                                                                                                                   ] 507,411     95.0K/s eta(英国中部时34% [==================================================================>                                                                                                                                 ] 523,795     92.9K/s eta(英国中部时35% [====================================================================>                                                                                                                               ] 540,179     91.2K/s eta(英国中部时36% [======================================================================>                                                                                                                             ] 556,563     85.9K/s eta(英国中部时37% [========================================================================>                                                                                                                           ] 572,947     84.7K/s eta(英国中部时38% [==========================================================================>                                                                                                                         ] 589,331     81.3K/s eta(英国中部时39% [============================================================================>                                                                                                                       ] 605,715     79.1K/s eta(英国中部时40% [==============================================================================>                                                                                                                     ] 622,099     75.2K/s eta(英国中部时41% [=================================================================================>                                                                                                                  ] 638,483     69.9K/s eta(英国中部时42% [===================================================================================> 
在下载完成之后,进行安装PIP:

[abcd@ZC_VM_10_100_138_xx redismonitor]# python get-pip.py 
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting pip
/tmp/tmpixMJsm/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
/tmp/tmpixMJsm/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)5% |██                              | 71kB 14kB/s eta 0:01:20
安装成功后,检查pip是否安装成功,打开teminal,

[abcd@ZC_VM_10_100_138_xxx redismonitor]# pipUsage:   pip <command> [options]Commands:install                     Install packages.download                    Download packages.uninstall                   Uninstall packages.freeze                      Output installed packages in requirements format.list                        List installed packages.show                        Show information about installed packages.search                      Search PyPI for packages.wheel                       Build wheels from your requirements.hash                        Compute hashes of package archives.completion                  A helper command used for command completionhelp                        Show help for commands.General Options:-h, --help                  Show help.--isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.-v, --verbose               Give more output. Option is additive, and can be used up to 3 times.-V, --version               Show version and exit.-q, --quiet                 Give less output.--log <path>                Path to a verbose appending log.--proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.--retries <retries>         Maximum number of retries each connection should attempt (default 5 times).--timeout <sec>             Set the socket timeout (default 15 seconds).--exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.--trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.--cert <path>               Path to alternate CA bundle.--client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.--cache-dir <dir>           Store the cache data in <dir>.--no-cache-dir              Disable the cache.--disable-pip-version-checkDon't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index
上述信息标识安装成功。

  参考内容: https://pip.pypa.io/en/latest/installing/

4. 安装redislive

   安装依赖包:

  • tornado pip install tornado
  • redis.py pip install redis
  • python-dateutil pip install python-dateutil

  安装argparse,由于当前python版本小于2.7

  • argparse pip install argparse
    下载源代码: git clone https://github.com/kumarnitin/RedisLive.git

  5. 配置RedisLive

   复制redis-live.conf的配置信息:

[abcd@ZC_VM_10_100_138_xxx src]$ vi redis-live.conf{"RedisServers":[{   # 添加 monitor target redis"server": "10.100.141.40","port" : 6394,"password":"abcdpwd"}],#将当前的存储模式设置sqlite,也可以为redis"DataStoreType" : "sqlite",# 存储用的redis server"RedisStatsServer":{"server" : "ec2-184-72-166-144.compute-1.amazonaws.com","port" : 6385},"SqliteStatsStore" :{ "path":  "monitor.sqlite"   #注意这里一定要设置到db目录下的sqlite文件,且需要绝对路径,否则将无法找到表,# 出现no table 'monitor'之类的错误信息。}
}
~
保存修改内容即可。

 6. 启动RedisLive

   进入RedisLive目录, 启动如下命令:

   >>>  ./redis-live.py    启动执行

   >>> ./redis-monitor.py --duration=20  #间隔20s之后执行该命令

   说明: 这里只是执行了一次该monitor命令,无法做到循环执行,这是让我非常困惑的地方,为什么没有做成循环执行呢,还是我没有发现其设置选项吗?

   

    参考资料:http://www.nkrode.com/article/real-time-dashboard-for-redis

7. 场景错误信息:

   a.  错误信息:OperationError : no table 'monitor'

[E 160927 15:16:35 web:1548] Uncaught exception GET /api/topkeys?from=Tue%2C+20+Sep+2016+07%3A16%3A37+GMT&to=Tue%2C+27+Sep+2016+07%3A16%3A37+GMT&server=10.100.141.40%3A6394 (10.10.153.123)HTTPServerRequest(protocol='http', host='10.100.138.82:8888', method='GET', uri='/api/topkeys?from=Tue%2C+20+Sep+2016+07%3A16%3A37+GMT&to=Tue%2C+27+Sep+2016+07%3A16%3A37+GMT&server=10.100.141.40%3A6394', version='HTTP/1.1', remote_ip='10.10.153.123', headers={'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3', 'Accept-Encoding': 'gzip, deflate', 'Host': '10.100.138.82:8888', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0', 'Connection': 'keep-alive', 'X-Requested-With': 'XMLHttpRequest', 'Referer': 'http://10.100.138.82:8888/index.html'})Traceback (most recent call last):File "/usr/lib64/python2.6/site-packages/tornado/web.py", line 1467, in _executeresult = method(*self.path_args, **self.path_kwargs)File "/home/yxgly/redismonitor/RedisLive/src/api/controller/TopKeysController.py", line 25, in getfor data in self.stats_provider.get_top_keys_stats(server, start, end):File "/home/yxgly/redismonitor/RedisLive/src/dataprovider/sqliteprovider.py", line 178, in get_top_keys_statsreturn [[r[0], r[1]] for r in c.execute(query, values)]OperationalError: no such table: monitor
[E 160927 15:16:35 web:1971] 500 GET /api/topkeys?from=Tue%2C+20+Sep+2016+07%3A16%3A37+GMT&to=Tue%2C+27+Sep+2016+07%3A16%3A37+GMT&server=10.100.141.40%3A6394 (10.10.153.123) 3.13ms
    解决办法: 将sqlite模式下的file Location设置到db/redislive.sqlite,重新启动即可。

 

8. 总结

  这是一次失败的环境搭建,因为这里还暂时没有做到实时的显示信息,后续还需要继续研究和实验。 

9. 参考资料:

  •    RedisLive的安装: http://sofar.blog.51cto.com/353572/1369266
  •  Redis Stat/RedisLive  http://ckl893.blog.51cto.com/8827818/1791301
  •   官方带评论的安装指南  http://www.nkrode.com/article/real-time-dashboard-for-redis
  •   redis监控方案  https://my.oschina.net/guol/blog/182265
  •  crontab http://www.cnblogs.com/ccdc/archive/2012/06/01/2529471.html




http://www.ppmy.cn/news/488375.html

相关文章

live2d内嵌html,为你的博客博客/网页添加Live2d二次元老婆的插件/手动方法

前言 好久没搞WP的教程了,想不想为你的博客加一个看板娘呢,反正我想2333,所以我便汇总了一下网上这些教程模型和机器人api。 插件版 Wordpress 1、Wikimoe大佬制作的插件(伊斯特瓦尔) 2、小白-白大佬制作的插件(22&33娘单服装版本) Github 3、小白-白大佬制作的插件(…

LIVE555学习5:testOnDemandRTSPServer例程解析

文章目录 1 主函数2 ServerMediaSession3 Source 和 Sink 关于testOnDemandRTSPServer例程分析&#xff0c;网上有很多文章&#xff0c;有些写的非常详细&#xff0c;将涉及到的每个函数以及类进行了详细讲解&#xff0c;看了之后很有收获&#xff0c;可是让自己写是如何也写不…

live555源码分析(八)多播

live555源码分析系列 live555源码分析&#xff08;一&#xff09;live555初体验 live555源码分析&#xff08;二&#xff09;基本组件上 live555源码分析&#xff08;三&#xff09;基本组件下 live555源码分析&#xff08;四&#xff09;RTSPServer分析 live555源码分析&…

LIVE555学习1:Linux下live555的编译及测试

以下为在linux下编译和测试live555的全部过程。 文章目录 1 源码下载2 编译3 测试 1 源码下载 官网地址&#xff1a;http://www.live555.com/liveMedia/public/ 打开后&#xff0c;选择live555-latest.tar.gz 2 编译 在主目录下创建文件config.3516c&#xff0c;内容如下&am…

live555读文件改为读内存

近期有一项工作涉及到视频流的传输&#xff0c;在RTSP服务器中实时转播国标服务器获取到的h264视频数据&#xff0c;而live555库只支持文件推流&#xff0c;经过几天的摸索&#xff0c;实现其功能&#xff0c;以此文档记录之。&#xff08;本次记录以live555库的mediaServer案例…

live555源码分析(七)播放过程

live555源码分析系列 live555源码分析&#xff08;一&#xff09;live555初体验 live555源码分析&#xff08;二&#xff09;基本组件上 live555源码分析&#xff08;三&#xff09;基本组件下 live555源码分析&#xff08;四&#xff09;RTSPServer分析 live555源码分析&…

【MySQL】如何速通MySQL(4)

&#x1f4cc;前言&#xff1a;本篇博客介绍如何速通MySQL的第四篇&#xff0c;主要介绍Mysql中主要的基础的入门&#xff0c;学习MySQL之前要先安装好MySQL&#xff0c;如果还没有安装的小伙伴可以看看博主前面的博客&#xff0c;里面有详细的安装教程。或者看一下下面这个链接…

flutter getx nested navigation 嵌套路由

flutter getx nested navigation 嵌套路由 视频 https://youtu.be/SXER4JVBFps 前言 嵌套路由可以用在如购物确认向导界面切换。 使用 getx 实现嵌套路由&#xff0c;需要如下步骤&#xff1a; 通过 Navigator 组件的 key 属性 用 Get.nestedKey(1) 进行标记 onGenerateRoute…