Redis-stat 的安装与使用
一、ruby源码安装
- 下载最新版的 Ruby 压缩文件。请点击这里下载。
- 下载 Ruby 之后,解压到新创建的目录下:
$ tar -xvzf ruby-2.2.3.tgz
$ cd ruby-2.2.3
- 现在,配置并编译源代码,如下所示:
$ ./configure
$ make
$ make install
- 安装后,通过在命令行中输入以下命令来确保一切工作正常:
$ruby -v
ruby 2.2.3……
二、替换rubygems为国内淘宝的
$ gem sources --remove https://rubygems.org/ $ gem sources -a https://gems.ruby-china.com/ $ gem sources -l
三、安装redis-stat# gem install redis-stat
或
# git clone https://github.com/junegunn/redis-stat.git
# cd redis-stat/bin/
#./redis-stat --help
四、使用redis-stat
# redis-stat host localhost port 6380 overview
实时打印出host为localhost,端口为6380,redis实例的总体信息
[root@Architect redis-1.2.6]# redis-stat port 6380 overview ------- data ------ ------------ load ----------------------------- - childs - keys used-mem clients requests connections 1319 5.37M 103 44108021 (+44108021) 810 1319 5.38M 103 44108124 (+103) 810 1319 5.38M 103 44108225 (+101) 810 1319 5.39M 103 44108326 (+101) 810 1319 5.40M 103 44108427 (+101) 810 1319 5.41M 103 44108528 (+101) 810
# redis-stat host localhost port 6380 latency
输出host为localhost,端口为6380,redis服务中每个请求的响应时长
[root@Architect redis-1.2.6]# redis-stat port 6380 latency 1: 0.16 ms 2: 0.11 ms 3: 0.15 ms 4: 0.11 ms 5: 0.18 ms 6: 0.14 ms
参考资料: https://github.com/junegunn/redis-stat