环境介绍:
系统:ubuntu14.04redis版本:redis-2.8.24监控工具:Redis Live、redis-stat
Redis 安装
- wget -c
- tar zxmf redis-2.8.24.tar.gz
- mkdir -pv /opt/redis/{etc,logs} /export/redis/data
- cd redis-2.8.24/ &&make && make PREFIX=/opt/redis/ install
-
vim /opt/redis/etc/redis.conf
daemonize yes
pidfile /var/run/redis.pid port 6379 timeout 0 tcp-backlog 10240 tcp-keepalive 0 loglevel warning logfile /opt/redis/logs/redis.log databases 16 save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes dbfilename dump.rdb dir /export/redis/data maxclients 10000 maxmemory-policy volatile-lru maxmemory-samples 3 appendonly yes appendfilename appendonly.aof appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 10000 auto-aof-rewrite-min-size 20000mb lua-time-limit 5000 slowlog-log-slower-than 10000 slowlog-max-len 128 hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-entries 512 list-max-ziplist-value 64 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit slave 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 -
/opt/redis/bin/redis-server /opt/redis/etc/redis.conf
RedisLive
python编写,分析查询语句并且有web界面的监控工具
注:长时间运行对Redis性能有所影响
安装RedisLive
- pip install tornado
- pip install redis
- pip install python-dateutil
git clone live项目
git cloneconf配置
cd srcvim redis-live.conf{ "RedisServers": [ { "server" : "你的Redis IP地址", "port" : 6379 } ........ 可以多个 ], "DataStoreType" : "redis", "RedisStatsServer": { "server" : "你的Redis 监控IP地址", "port" : 6379 }, "SqliteStatsStore" : { "path": "to your sql lite file" }}
启动监控脚本,监控120秒,duration参数是以秒为单位
./redis-monitor.py —duration=120启动webserver。
RedisLive使用tornado作为web服务器,所以不需要单独安装服务器Tornado web server 是使用Python编写出來的一个极轻量级、高可伸缩性和非阻塞IO的Web服务器软件./redis-live.pyRedisstat
一个用ruby写成的监控redis的程序,基于info命令获取信息,而不是通过monitor获取信息,性能应该比monitor要好。
官网:
ruby环境安装
apt-get install rubyapt-get install rubygemsredis-stat安装:
gem install redis-stat如果报错请升级一下ruby使用
命令行模式redis-stat localhost:6379 1 10web界面模式redis-stat —verbose —server=8080 5