在 memcached 中的 redis 中是否有类似stats
的命令,它会提供累计get
,set
操作数分开。
e.g。在memcached中我可以执行stats
命令,它给出了:
STAT pid 1905
STAT uptime 87713
STAT time 1469108527
STAT version 1.4.25
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 300.101330
STAT rusage_system 711.654138
STAT curr_connections 18
STAT total_connections 4698
STAT connection_structures 739
STAT reserved_fds 40
STAT cmd_get 75355568
STAT cmd_set 3296663
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 44369791
STAT get_misses 30985777
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 3615072874
STAT bytes_written 16173356516
STAT limit_maxbytes 3670016000
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT time_in_listen_disabled_us 0
STAT threads 8
STAT conn_yields 1763246
STAT hash_power_level 17
STAT hash_bytes 1048576
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT bytes 331012787
STAT curr_items 176322
STAT total_items 3296663
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 0
STAT crawler_reclaimed 0
STAT crawler_items_checked 0
STAT lrutail_reflocked 0
END
使用这个我可以在最后一秒找出get操作的数量(通过在python中使用任何客户端库减去)。我想获得redis每秒获取和设置操作的次数。
我找到的唯一命令是info
,它有一个 stats 部分,但它看起来像这样:
# Stats
slave_sync_total_commands_processed:0
slave_sync_instantaneous_ops_per_sec:0
total_commands_processed:11562138
instantaneous_ops_per_sec:0
total_connections_received:6139
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
pubsub_channels:0
pubsub_patterns:0
expire_scan_keys:0
而且我也不知道如何使用它来查找获取和设置操作的每秒统计数据。是否有任何黑客或命令可以为 redis 执行此操作?最好是可以通过python以编程方式完成的事情。
答案 0 :(得分:2)
不是黑客,而是真正的犹太洁食解决方案 - 使用<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</div>
</nav>
或仅INFO ALL
获取该信息(默认情况下不提供)。