安装redis-live监控redis集群

监控redis集群服务的软件还不少,但是可视化的不多,了解到的就是redis-live和radish。

但是radish国内貌似登陆不了,要翻墙,而且是收费软件,没用上。

这里主要就是描述一下redis-live的安装和使用。

相关网址:https://github.com/nkrode/RedisLive

目前所知的监控软件基本都是根据redis的命令monitor和info来做的,如果只是需要一些统计信息,自己弄一个也不难。


一、安装 (保证自己的python版本在2.7之后)

apt-get install python-setuptools python-dev

easy_install pip

pip install dateutil//安装了python-dev后就不需要安装这个了,已经包含其中了

pip install redis

pip install tornado// 不安装的话在运行redis-live.py的时候报错


二、部署配置

a. 在Github下载nkrode-RedisLive-3a18ddc.zip

b. 修改配置文件

vi ./src/redis-live.conf

可以看出这个配置文件是json格式的,注意不要产生格式错误,对着原始的配置文件来

原始的配置文件如下:

{
        "RedisServers":
        [ 
                {
                        "server": "154.17.59.99",
                        "port" : 6379
                },

                {
                        "server": "localhost",
                        "port" : 6380,
                        "password" : "some-password"
                }
        ],

        "DataStoreType" : "redis",

        "RedisStatsServer":
        {
                "server" : "ec2-184-72-166-144.compute-1.amazonaws.com",
                "port" : 6385
        },

        "SqliteStatsStore" :
        {
                "path":  "to your sql lite file"
        }
}

解析一下:

RedisServers: 就是所要监控的redis集群的所有主机,可以配置host, port, password,注意最后一个元素后面没有逗号。

DataStoreType: 就是类似元数据存储的类型,默认是redis,也可以是sqlite;

RedisStatsServer: 如果存储类型选择了reids,就需要配置此项,即另外拿出一个redis来存储其他redis的状态信息,也就是上面说的元数据。

SqliteStatisStore: 如果存储类型选择了sqlite,就配置此项,指定一个路径保存sqlite文件。

没仔细研究,估计是已经把sqlite文件包含在安装文件里头了。


三、启动

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

./redis-live.py

http://redisLive_host:8888/index.html


以上两个进程都是默认前台运行,可以弄到后台去执行

nohup ./redis-monitor.py --duration=36000 --quiet &

        nohup ./redis-live.py --log_file_prefix=/home/user/log/redis_live --logging=warning &


usage: redis-monitor.py [-h] --duration DURATION [--quiet]

Monitor redis.

optional arguments:
  -h, --help           show this help message and exit
  --duration DURATION  duration to run the monitor command (in seconds)
  --quiet              do not write anything to standard output

Usage: ./redis-live.py [OPTIONS]

Options:

  --debug                          debug mode (default 0)
  --help                           show this help information
  --port                           run on the given port (default 8888)

/usr/local/lib/python2.7/dist-packages/tornado/log.py options:

  --log_file_max_size              max size of log files before rollover
                                   (default 100000000)
  --log_file_num_backups           number of log files to keep (default 10)
  --log_file_prefix=PATH           Path prefix for log files. Note that if you
                                   are running multiple tornado processes,
                                   log_file_prefix must be different for each
                                   of them (e.g. include the port number)
  --log_to_stderr                  Send log output to stderr (colorized if
                                   possible). By default use stderr if
                                   --log_file_prefix is not set and no other
                                   logging is configured.
  --logging=debug|info|warning|error|none 
                                   Set the Python log level. If 'none', tornado
                                   won't touch the logging configuration.
                                   (default info)




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值