Fork me on GitHub

Redis常用命令

Redis Server 命令

 

 

Redis-cli.exe 命令

 

查看过滤信息
redis-cli -r -1 -i 1 INFO | grep rss_human
-r 表示请求几次,-1表示连续查询
-i 表示请求间隔,1表示1秒查询1次

例如:
redis-cli -r 3 -i 3 INFO | grep rss_human

Interactive mode

选择切换库
select 0~15

例如:
select 0

查看库大小
dbsize

例如:
dbsize

连续的数据模式
redis-cli.exe --stat

例如:
指定端口,含有密码访问
redis-cli.exe -p 6370 -a abc123 --stat

PS D:\RedisCache\Redis3.0-6370> .\redis-cli.exe -p 6370 -a abc123 --stat
------- data ------ --------------------- load -------------------- - child -
keys       mem      clients blocked requests            connections
2          824.07M  9       0       258552 (+0)         356
2          824.07M  9       0       258555 (+3)         356
2          824.07M  9       0       258560 (+5)         356
2          824.11M  9       0       258563 (+3)         356
2          824.07M  9       0       258567 (+4)         356
2          824.07M  9       0       258569 (+2)         356
2          824.07M  9       0       258571 (+2)         356
2          824.11M  9       0       258576 (+5)         356
2          824.07M  9       0       258577 (+1)         356
2          824.07M  9       0       258580 (+3)         356
2          824.11M  9       0       258584 (+4)         356
2          824.07M  9       0       258586 (+2)         356
2          824.07M  9       0       258588 (+2)         356
2          824.07M  9       0       258593 (+5)         356
2          824.14M  9       0       258597 (+4)         356
2          824.07M  9       0       258599 (+2)         356
2          824.07M  9       0       258602 (+3)         356
2          824.11M  9       0       258607 (+5)         356
2          824.11M  9       0       258609 (+2)         356
2          824.11M  9       0       258614 (+5)         356
------- data ------ --------------------- load -------------------- - child -
keys       mem      clients blocked requests            connections
2          824.07M  9       0       258616 (+2)         356
2          824.07M  9       0       258619 (+3)         356
2          824.07M  9       0       258623 (+4)         356
2          824.07M  9       0       258626 (+3)         356
2          824.07M  9       0       258631 (+5)         356
2          824.07M  9       0       258634 (+3)         356
2          824.07M  9       0       258638 (+4)         356
2          824.07M  9       0       258643 (+5)         356
2          824.07M  9       0       258646 (+3)         356
2          824.11M  9       0       258649 (+3)         356
2          824.11M  9       0       258651 (+2)         356
2          824.11M  9       0       258657 (+6)         356
2          824.07M  9       0       258660 (+3)         356
2          824.07M  9       0       258663 (+3)         356
2          824.07M  9       0       258666 (+3)         356
2          824.07M  9       0       258668 (+2)         356
2          824.07M  9       0       258670 (+2)         356
PS D:\RedisCache\Redis3.0-6370>

 

查看统计大数据key值
redis-cli.exe --bigkeys

例如:
指定端口,含有密码访问
redis-cli.exe -p 6370 -a abc123 --bigkeys

PS D:\RedisCache\Redis3.0-6370> .\redis-cli.exe -p 6370 -a abc123 --bigkeys

# Scanning the entire keyspace to find biggest keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

[00.00%] Biggest hash   found so far 'G_AppResWx' with 2 fields
[00.00%] Biggest hash   found so far 'G_PortalGetAppCache' with 60656 fields
[00.00%] Biggest hash   found so far 'G_UserAppBind' with 4884861 fields

-------- summary -------

Sampled 18 keys in the keyspace!
Total key length in bytes is 281 (avg len 15.61)

Biggest   hash found 'G_UserAppBind' has 4884861 fields

0 strings with 0 bytes (00.00% of keys, avg size 0.00)
0 lists with 0 items (00.00% of keys, avg size 0.00)
0 sets with 0 members (00.00% of keys, avg size 0.00)
18 hashs with 8200012 fields (100.00% of keys, avg size 455556.22)
0 zsets with 0 members (00.00% of keys, avg size 0.00)
PS D:\RedisCache\Redis3.0-6370>

 

查看监控redis读写使用情况
redis-cli.exe monitor

例如:
指定端口,含有密码访问
redis-cli.exe -p 6370 -a abc123 monitor

PS D:\RedisCache\Redis3.0-6370> .\redis-cli.exe -p 6360 -a abc123 monitor
OK
1499582932.252820 [0 127.0.0.1:28432] "HSET" "G_AppDetailArea" "newAppShared278ad98-734e-4199-8d00-a42a87e36fc2" "\x00\x
01\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00\x00\x00\x00\x00\x0c\x02\x00\x00\x00LJinher.AMP.App.Deploy, Version=1.0.0.
0, Culture=neutral, PublicKeyToken=null\x05\x01\x00\x00\x00/Jinher.AMP.App.Deploy.CustomDTO.AppShareInfoDTO\n\x00\x00\x0
0\x1d<ShareContent>k__BackingField\x1b<ShareTopic>k__BackingField\x1a<ShareDesc>k__BackingField\x1d<ShareMessSrc>k__Back
ingField\x1d<ShareGotoUrl>k__BackingField\x15<Icon>k__BackingField\x1d<StraightIcon>k__BackingField(ReturnInfoDTO+<IsSuc
cess>k__BackingField&ReturnInfoDTO+<Message>k__BackingField)ReturnInfoDTO+<StatusCode>k__BackingField\x01\x01\x01\x01\x0
1\x01\x01\x00\x01\x01\x01\x02\x00\x00\x00\x06\x03\x00\x00\x00E\xe5\x93\x81\xe5\x91\xb3\xe5\x9b\xbd\xe5\xad\xa6\xe7\xbb\x
8f\xe5\x85\xb8\xef\xbc\x8c\xe6\x8f\x90\xe9\xab\x98\xe6\x96\x87\xe5\x8c\x96\xe7\xb4\xa0\xe5\x85\xbb\xe3\x80\x82\xe6\xaf\x
8f\xe6\x97\xa5\xe6\x9b\xb4\xe6\x96\xb0\xef\xbc\x8c\xe6\xaf\x8f\xe6\x97\xa5\xe8\xaf\xb5\xe8\xaf\xbb\x06\x04\x00\x00\x00\x
12\xe5\x9b\xbd\xe5\xad\xa6\xe7\xbb\x8f\xe5\x85\xb8\xe8\x82\xb2\xe5\x84\xbf\x06\x05\x00\x00\x00E\xe5\x93\x81\xe5\x91\xb3\
xe5\x9b\xbd\xe5\xad\xa6\xe7\xbb\x8f\xe5\x85\xb8\xef\xbc\x8c\xe6\x8f\x90\xe9\xab\x98\xe6\x96\x87\xe5\x8c\x96\xe7\xb4\xa0\
xe5\x85\xbb\xe3\x80\x82\xe6\xaf\x8f\xe6\x97\xa5\xe6\x9b\xb4\xe6\x96\xb0\xef\xbc\x8c\xe6\xaf\x8f\xe6\x97\xa5\xe8\xaf\xb5\
xe8\xaf\xbb\x06\x06\x00\x00\x00\x12\xe5\x9b\xbd\xe5\xad\xa6\xe7\xbb\x8f\xe5\x85\xb8\xe8\x82\xb2\xe5\x84\xbf\x06\a\x00\x0
0\x00Thttp://appres.iuoooo.com/app/GetAppDetail?appId=d278ad98-734e-4199-8d00-a42a87e36fc2\x06\b\x00\x00\x00\xb3\x01http
://fileserver.iuoooo.com/Jinher.JAP.BaseApp.FileServer.UI/FileManage/GetFile?fileURL=29E54E46-3E17-4CA4-8F03-DB71FB8F966
0/CustomImg/2ff47661-0ebf-44d2-accf-d3e42de8cd3f_96.png\x06\t\x00\x00\x00\x00\x00\n\n\x0b"
1499582933.924673 [0 10.172.158.12:51158] "PING"
1499582934.080921 [0 10.165.118.63:52684] "PING"
1499582934.565290 [0 127.0.0.1:28432] "HSET" "G_AppDetailArea" "newAppShareb459f0a0-d7b9-4c08-b2d6-a26652c1dbc9" "\x00\x
01\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00\x00\x00\x00\x00\x0c\x02\x00\x00\x00LJinher.AMP.App.Deploy, Version=1.0.0.
0, Culture=neutral, PublicKeyToken=null\x05\x01\x00\x00\x00/Jinher.AMP.App.Deploy.CustomDTO.AppShareInfoDTO\n\x00\x00\x0
0\x1d<ShareContent>k__BackingField\x1b<ShareTopic>k__BackingField\x1a<ShareDesc>k__BackingField\x1d<ShareMessSrc>k__Back
ingField\x1d<ShareGotoUrl>k__BackingField\x15<Icon>k__BackingField\x1d<StraightIcon>k__BackingField(ReturnInfoDTO+<IsSuc
cess>k__BackingField&ReturnInfoDTO+<Message>k__BackingField)ReturnInfoDTO+<StatusCode>k__BackingField\x01\x01\x01\x01\x0
1\x01\x01\x00\x01\x01\x01\x02\x00\x00\x00\x06\x03\x00\x00\x009\xe8\xbf\x99\xe4\xb8\xaa\xe5\xba\x94\xe7\x94\xa8\xe5\xbe\x
88\xe6\xa3\x92\xef\xbc\x8c\xe6\x88\x91\xe6\xad\xa3\xe5\x9c\xa8\xe4\xbd\xbf\xe7\x94\xa8\xef\xbc\x8c\xe5\xbf\xab\xe4\xb8\x
8b\xe8\xbd\xbd\xe4\xbd\x93\xe9\xaa\x8c\xe4\xb8\x8b\x06\x04\x00\x00\x00\x15\xe5\x84\xbf\xe7\xab\xa5\xe6\x95\x85\xe4\xba\x
8b\xe6\x9c\x89\xe5\xa3\xb0\xe7\x89\x88\x06\x05\x00\x00\x009\xe8\xbf\x99\xe4\xb8\xaa\xe5\xba\x94\xe7\x94\xa8\xe5\xbe\x88\
xe6\xa3\x92\xef\xbc\x8c\xe6\x88\x91\xe6\xad\xa3\xe5\x9c\xa8\xe4\xbd\xbf\xe7\x94\xa8\xef\xbc\x8c\xe5\xbf\xab\xe4\xb8\x8b\
xe8\xbd\xbd\xe4\xbd\x93\xe9\xaa\x8c\xe4\xb8\x8b\x06\x06\x00\x00\x00\x15\xe5\x84\xbf\xe7\xab\xa5\xe6\x95\x85\xe4\xba\x8b\
xe6\x9c\x89\xe5\xa3\xb0\xe7\x89\x88\x06\a\x00\x00\x008http://bac.iuoooo.com/AppShare/Index?EnglishName=1180984\x06\b\x00
\x00\x00\xb3\x01http://fileserver.iuoooo.com/Jinher.JAP.BaseApp.FileServer.UI/FileManage/GetFile?fileURL=29E54E46-3E17-4
CA4-8F03-DB71FB8F967E/CustomImg/60802b25-1970-4be6-ab5f-5f00a592baf0_96.png\x06\t\x00\x00\x00\x00\x00\n\n\x0b"
1499582934.580915 [0 127.0.0.1:28432] "HSET" "G_AppDetailArea" "newAppShare7464c8c6-e695-4b82-b8c6-ae66c040c715" "\x00\x
01\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00\x00\x00\x00\x00\x0c\x02\x00\x00\x00LJinher.AMP.App.Deploy, Version=1.0.0.
0, Culture=neutral, PublicKeyToken=null\x05\x01\x00\x00\x00/Jinher.AMP.App.Deploy.CustomDTO.AppShareInfoDTO\n\x00\x00\x0
0\x1d<ShareContent>k__BackingField\x1b<ShareTopic>k__BackingField\x1a<ShareDesc>k__BackingField\x1d<ShareMessSrc>k__Back
ingField\x1d<ShareGotoUrl>k__BackingField\x15<Icon>k__BackingField\x1d<StraightIcon>k__BackingField(ReturnInfoDTO+<IsSuc
cess>k__BackingField&ReturnInfoDTO+<Message>k__BackingField)ReturnInfoDTO+<StatusCode>k__BackingField\x01\x01\x01\x01\x0
1\x01\x01\x00\x01\x01\x01\x02\x00\x00\x00\x06\x03\x00\x00\x009\xe8\xbf\x99\xe4\xb8\xaa\xe5\xba\x94\xe7\x94\xa8\xe5\xbe\x
88\xe6\xa3\x92\xef\xbc\x8c\xe6\x88\x91\xe6\xad\xa3\xe5\x9c\xa8\xe4\xbd\xbf\xe7\x94\xa8\xef\xbc\x8c\xe5\xbf\xab\xe4\xb8\x
8b\xe8\xbd\xbd\xe4\xbd\x93\xe9\xaa\x8c\xe4\xb8\x8b\x06\x04\x00\x00\x00\x15\xe7\x99\xbe\xe5\xae\xb6\xe8\xae\xb2\xe5\x9d\x
9b\xe7\xbb\x8f\xe5\x85\xb8\xe7\x89\x88\x06\x05\x00\x00\x009\xe8\xbf\x99\xe4\xb8\xaa\xe5\xba\x94\xe7\x94\xa8\xe5\xbe\x88\
xe6\xa3\x92\xef\xbc\x8c\xe6\x88\x91\xe6\xad\xa3\xe5\x9c\xa8\xe4\xbd\xbf\xe7\x94\xa8\xef\xbc\x8c\xe5\xbf\xab\xe4\xb8\x8b\
xe8\xbd\xbd\xe4\xbd\x93\xe9\xaa\x8c\xe4\xb8\x8b\x06\x06\x00\x00\x00\x15\xe7\x99\xbe\xe5\xae\xb6\xe8\xae\xb2\xe5\x9d\x9b\
xe7\xbb\x8f\xe5\x85\xb8\xe7\x89\x88\x06\a\x00\x00\x008http://bac.iuoooo.com/AppShare/Index?EnglishName=1168655\x06\b\x00
\x00\x00\xb3\x01http://fileserver.iuoooo.com/Jinher.JAP.BaseApp.FileServer.UI/FileManage/GetFile?fileURL=29E54E46-3E17-4
CA4-8F03-DB71FB8F967F/CustomImg/799e43e7-e9b2-4552-9e6f-a6a7f02d4765_96.png\x06\t\x00\x00\x00\x00\x00\n\n\x0b"
1499582934.737163 [0 127.0.0.1:30880] "PING"
PS D:\RedisCache\Redis3.0-6370>

 

posted @ 2017-07-09 14:43  chenpw  阅读(436)  评论(0)    收藏  举报
View Code