redis服务监控

Redis服务的监控

博客分类:

memcache+redis

redis 监控工具安装配置
http://blog.sina.com.cn/s/blog_53fab15a01018w8g.html
http://ylw6006.blog.51cto.com/470441/1006313



centos6.3上redmon和redis-live两款开源软件的使用情况,前者基于ruby,后者则基于python


=================================== 自带的




   redis-server:Redis服务器的daemon启动程序
   redis-cli:Redis命令行操作工具。当然,你也可以用telnet根据其纯文本协议来操作
   redis-benchmark:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能
   redis-stat:Redis状态检测工具,可以检测Redis当前状态参数及延迟状况




100个并发连接,100000个请求,检测host为localhost 端口为6379的redis服务器性能
/usr/local/redis/src/redis-benchmark -h localhost -p 6378 -c 100 -n 100000


====== LRANGE (first 300 elements) ======
 100000 requests completed in 10.63 seconds
 100 parallel clients
 3 bytes payload
 keep alive: 1

0.00% <= 1 milliseconds
0.01% <= 2 milliseconds
0.02% <= 3 milliseconds
0.05% <= 4 milliseconds
7.12% <= 5 milliseconds
96.77% <= 6 milliseconds
99.86% <= 7 milliseconds
99.89% <= 8 milliseconds
99.92% <= 9 milliseconds
99.94% <= 10 milliseconds
99.95% <= 12 milliseconds
99.96% <= 17 milliseconds
99.96% <= 22 milliseconds
99.96% <= 24 milliseconds
99.99% <= 25 milliseconds
100.00% <= 25 milliseconds
9408.22 requests per second



监控host为localhost,端口为6380,redis的连接及读写操作
/usr/local/redis/src/redis-cli -h localhost -p 6378 monitor


提供host为localhost,端口为6380,redis服务的统计信息
/usr/local/redis/src/redis-cli -h localhost -p 6378 info  

实时打印出host为localhost,端口为6380,redis实例的总体信息
/usr/local/redis/src/redis-stat port 6378 overview


==================================== redmon

whereis ruby
清除掉旧的ruby版本



#cd /root/
#bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
#echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile


#/usr/local/rvm/bin/rvm list known
#/usr/local/rvm/bin/rvm install 1.9.2
#/usr/local/rvm/bin/rvm alias create default ruby-1.9.2-p320  
#/usr/local/rvm/bin/rvm list  
   rvm rubies

   =* ruby-1.9.2-p320 [ x86_64 ]  

   # => - current  
   # =* - current && default  
   #  * - default  

#ruby -v  
   ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]

#ln -s /usr/local/rvm/bin/ruby /usr/bin/ruby
#ln -s /usr/local/rvm/bin/gem /usr/bin/gem
#ln -s /usr/local/ruby/bin/gem /usr/local/bin/gem
#ln -s /usr/local/rvm/bin/bundle /usr/local/bin/bundle

#gem install bundler
#git clone https://github.com/steelThread/redmon.git

#vim redmon/bin/redmon
#vim redmon/lib/redmon/config.rb



#grep -A 4 'option :redis_url' redmon/bin/redmon
 option :redis_url,
   :short       => '-r URL',
   :long        => '--redis URL',
   :default     => 'redis://192.168.1.225:6378',
   :description => "The Redis url for monitor (default: redis://192.168.1.78:6377)"




#grep -A 9 'class Config' redmon/lib/redmon/config.rb

 class Config
   DEFAULTS = {
     :namespace     => 'redmon',
     :redis_url     => 'redis://192.168.1.225:6378',
     :app           => true,
     :worker        => true,
     :web_interface => ['0.0.0.0', 4567],
     :poll_interval => 10,
     :secure        => false
   }


 #bundler install (或者是先cd redmon/  然后bundler install )
 #cd redmon/  
 #bundle exec /root/redmon/bin/redmon


http://192.168.1.75:4567/



cf22886c-6198-3367-8973-781ba33ee59b.jpg


 ==================== redis-live:配置监控多台redis非常方便

 wget http://dl.fedoraproject.org/pub/epel/6/x86_64/python-pip-0.8-1.el6.noarch.rpm  
 rpm -ivh python-pip-0.8-1.el6.noarch.rpm
 pip-python install tornado  
 pip-python install redis  
  pip-python install python-dateutil
 pip-python install argparse  
 git clone https://github.com/kumarnitin/RedisLive.git  
 cd RedisLive/src  
 vim redis-live.conf

{
       "RedisServers":
       [
               {
                 "server": "192.168.1.161",
                 "port" : 6378
               },

              {  
                 "server" : "192.168.1.78",  
                 "port"  : 6380  
               },
       ],

       "DataStoreType" : "sqlite",

       "RedisStatsServer":
       {
               "server" : "127.0.0.1",
               "port" : 6381
       }
}
 ./redis-monitor.py --duration  120  &  
 ./redis-live.py  &
 netstat -ntpl |grep python
 tcp        0      0 0.0.0.0:8888                0.0.0.0:*                   LISTEN      7256/python



http://192.168.1.79:8888/index.html



66cd983c-570d-32cd-a701-5b695239aafb.jpg


你可能感兴趣的:(redis, , ,redmon,redis-live)