redisデータベースの適用ステータスの監視:python,tornado実装

4147 ワード

     redis         ,     ,          ,    ,             redis-live     ,        ,      ,         debug,
      

    ,         NOSQL   ,           。             redis     ,      redis    。

        redis-live:
  redis-live   python   ,           python  

1.wget http://dl.fedoraproject.org/pub/epel/6/x86_64/python-pip-0.8-1.el6.noarch.rpm
2.rpm -ivh python-pip-0.8-1.el6.noarch.rpm
3.pip-python install tornado
4.pip-python install redis
5.pip-python install python-dateutil
6.pip-python install argparse
        ,          。

git clone https://github.com/kumarnitin/RedisLive.git
Initialized empty Git repository in /root/RedisLive/.git/
remote: Counting objects: 715, done.
remote: Compressing objects: 100% (377/377), done.
remote: Total 715 (delta 338), reused 699 (delta 323)
Receiving objects: 100% (715/715), 2.59 MiB | 353 KiB/s, done.
Resolving deltas: 100% (338/338), done.
          ,        git   。
           :

cd RedisLive/src
vi redis-live.conf
{
        "RedisServers":
        [
                {
                  "server" : "127.0.0.1",
                  "port"  : 6379
                }
        ],

        "DataStoreType" : "sqlite",

        "RedisStatsServer":
        {
                "server" : "127.0.0.1",
                "port" : 6381
        }
}
RedisServers   redis      。
RedisStatsServer redis                redis    .   RedisStatsServe.
     ”DataStoreType”  sqlite   ,   RedisStatsServer      .

 :    redis             ,         ,   RedisServers      :  :

        "RedisServers":
        [
                {
                  "server" : "127.0.0.1",
                  "port"  : 6379,
                  "password":"xxxxxx"
                }
        ],
     ,        。
./redis-monitor.py –duration 120 &
./redis-live.py &
 :      ,    web    ,          ,         ,    redis-live.py   

[root@localhost src]# ./redis-live.py --help
Usage: ./redis-live.py [OPTIONS]

Options:

  --help                           show this help information
  --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)
         ,  ,       。
          :
           ,
1,  api/util/setting.py            redis-live.conf,     ,      json      ,   load          ,          ,    ,  ,      ,     .    ,  setting.py          ,   key     redis-live.conf      ,   setting.py  ,
    : setting.py  import redis_live.py          ,        , import sys; sys.path.append("   ")   .

2,api/controller/BaseController.py           ,dataprovider,      ,    dataprovider      ,       ,