測試環境:
redis版本:2.4.17
IP:10.20.111.188
1 redis-faina
一個使用redis自帶命令monitor的輸出結果做分析的python腳本,在命令行下使用,可以做實時分析使用。
官網:https://github.com/Instagram/redis-faina
下載試用:
1
2
3
4
|
cd / opt / test git clone https: / / github.com / Instagram / redis - faina.git cd redis - faina / redis - cli - p
6379 MONITOR | head
- n 100
| . / redis - faina.py - - redis - version = 2.4 |
可以看到一些實時的數據,並且有一定的統計數據,可以作爲一個命令行工具使用。推薦使用,不過redis版本要大於2.4。
2 redis-live
一個用來監控redis實例,分析查詢語句並且有web界面的監控工具,python編寫。
官網:https://github.com/nkrode/RedisLive
下載試用:
運行環境依賴包安裝:http://www.nkrode.com/article/real-time-dashboard-for-redis
redis-live安裝:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
cd / root
git clone https: / / github.com / nkrode / RedisLive.git cd RedisLive / src ###修改redis-live.conf文件
{ "RedisServers" : [ { "server" : "10.20.111.188" , "port" :
6379 } ], "DataStoreType" :
"redis" , "RedisStatsServer" : { "server" :
"10.20.111.188" , "port" :
6380 }, "SqliteStatsStore" :
{ "path" : "to your sql lite file" } } ###修改完畢
###啓動監控服務,每30秒監控一次 . / redis - monitor.py - - duration = 30 ###再次開啓一個終端,進入/root/RedisLive/src目錄,啓動web服務 . / redis - live.py |
一個web界面,可以同時監控多個redis實例,做集中監控比較好。
3 redis-stat
一個用ruby寫成的監控redis的程序,基於info命令獲取信息,而不是通過monitor獲取信息,性能應該比monitor要好。
官網:https://github.com/junegunn/redis-stat
運行環境安裝:
1
2
|
apt - get install ruby apt - get install rubygems |
1
2
3
4
5
|
cd / root
git clone https: / / github.com / junegunn / redis - stat.git cd / root / redis - stat / bin ###./redis-stat
--help 可以看到使用幫助 . / redis - stat 1 |
1
2
3
4
5
6
7
8
9
10
11
12
13
|
usage: redis - stat [HOST[:PORT] ...] [INTERVAL [COUNT]] - a, - - auth = PASSWORD
Password - v, - - verbose
Show more info - - style = STYLE
Output style: unicode |ascii - - no - color
Suppress ANSI color codes - - csv = OUTPUT_CSV_FILE_PATH
Save the result in
CSV format - - server[ = PORT]
Launch redis - stat web server (default port: 63790 )
- - daemon Daemonize redis - stat.
Must be used with - - server option. - - version Show version - - help Show
this message |
1
2
3
4
5
6
7
|
redis - stat redis - stat 1 redis - stat 1
10 redis - stat - - verbose redis - stat localhost: 6380 1
10 redis - stat localhost localhost: 6380 localhost: 6381 5 redis - stat localhost localhost: 6380 1
10
- - csv = / tmp / output.csv - - verbose |
1
2
3
|
redis - stat - - server redis - stat - - verbose - - server = 8080 5 redis - stat - - server - - daemon |
效果如下:
運行web模式
1
2
|
cd / root / redis - stat / bin . / redis - stat - - server = 8080 5
- - daemon |
不錯的工具,既有命令行又有web界面,可以放到後臺運行,數據比redis-live感覺直觀 ,ruby開發的,唯一的缺點是如果同時監控多個redis實例,不能單獨顯示每一個實例的數據信息,貌似是總和。
4 redis-monitor
一個國人用java寫的,官網的是在win下編譯的,看着不錯,不過我在linux下沒調試起來...
官網:https://github.com/litiebiao2012/redis-monitor
個人感覺,做集中監控可以使用redis-live,在命令行使用可以使用redis-stat,也可以根據自己的情況自行編寫,總之就是根據info和monitor命令獲取並展示信息。