connect($host, $port);
$stat = $redis->info();
$stat['server'] = "{$host}:{$port}";
if($stat['process_id']) {
$item = $redis->config('GET', 'maxmemory');
$stat['maxmemory'] = $item['maxmemory'];
$item = $redis->config('GET', 'databases');
$stat['databases'] = $item['databases'] ? intval($item['databases']) : 16;
}
} catch (RedisException $e) {
$stat = false;
}
return $stat;
}
function parse_db_stat($stat)
{
$ret = [];
if (empty($stat)) {
return $ret;
}
$arr = explode(',', $stat);
foreach ($arr as $item) {
list($k, $v) = explode('=', $item, 2);
$ret[$k] = $v;
}
return $ret;
}
$redisStats = array();
$redisStats['default'] = stat_redis($cfg['redis_host'], $cfg['redis_port']);
?>
缓存状态监控
Redis
名称 |
地址 |
进程ID |
版本号 |
上线时长 |
用户CPU时长 |
OPS/QPS |
总空间 |
已用空间 |
过期数 |
丢弃数 |
当前客户端 |
阻塞客户端 |
总接收连接数 |
总处理指令数 |
拒绝连接数 |
获取命中 |
获取未命中 |
DB0使用 |
$stats) { if (!$stats) continue; ?>
|
|
|
|
天 |
秒 |
|
|
M |
|
|
|
|
|
|
|
|
|
|
$stats) { ?>
Redis -
DB序号 |
KEY数量 |
过期数 |
平均有效期 |
|
- |
- |
- |
|
|
|