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/
==================== 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