1. 程式人生 > >redis的常用命令、問題和一些快取清理

redis的常用命令、問題和一些快取清理


Q、C盤空間不足
解決方式:多資料夾檢視大小,逐步縮小方位,
最終定位位置:
快取清理目錄:C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Redis
[圖片]

Q、檢視redis版本和redis埠:
1、進入cmd-輸入redis-cli
2、以中文的方式進入頁面:redis-cli –raw

Q、檢視redis埠是否有連線

C:\Users\luosan>netstat -nat | find “6379”
TCP 0.0.0.0:6379 0.0.0.0:0 LISTENING InHost
TCP 127.0.0.1:6379 127.0.0.1:52752 ESTABLISHED InHost
TCP 127.0.0.1:6379 127.0.0.1:52769 ESTABLISHED InHost
TCP 127.0.0.1:6379 127.0.0.1:54999 ESTABLISHED InHost
TCP 127.0.0.1:52752 127.0.0.1:6379 ESTABLISHED InHost
TCP 127.0.0.1:52769 127.0.0.1:6379 ESTABLISHED InHost
TCP 127.0.0.1:54999 127.0.0.1:6379 ESTABLISHED InHost
TCP [::]:6379 [::]:0 LISTENING InHost

Q、redis測試普通資料:

1 redis> set test “我們”
2 OK
3 redis> get test
4 “\xe6\x88\x91\xe4\xbb\xac”
如何在get時取到它的中文呢?只需要在redis-cli 後面加上 –raw
redis> get test
“我們”

Q、查詢redis的牌號是否存在:
C:\Users\luosan>redis-cli
127.0.0.1:6379> lrange memcache.designation 1 1
1) “dc5c7986daef50c1e02ab09b442ee34f|001~ABS||1~0”
127.0.0.1:6379> lrange memcache.designation 1 1
1) “dc5c7986daef50c1e02ab09b442ee34f|001~ABS||1~0”
127.0.0.1:6379> lrange memcache.designation2 1 1
(empty list or set)
127.0.0.1:6379>

Q、查詢redis所有資料:
keys * 取出當前所有的key
exists name 檢視n是否有name這個key

Q、連線別人的redis:
redis修改埠請求別人的主機redis
當然別人的主機redis也是需要設定訪問許可權才行
設定配置在init.properties
REDIS_HOST=192.168.4.206
REDIS_PORT=6379

Q、電子盤為例redis造資料
更多資料圖片資訊進入(http://note.youdao.com/yws/public/redirect/share?id=a57c49cc8489956496c7cc41344ae64b&type=false


設定新增的標的
hmset etrade_target_summaries:0412 4 4:LDPE:550J:::0:0.0:8590.0:0.0:0.0:0.0:0.0:8600:-;-
hmset etrade_target_summaries:0412 5 5:LLDPE:7042:::0:0.0:8590.0:0.0:0.0:0.0:0.0:8600:-;-
hmset etrade_target_summaries:0412 6 6:LDPE:7042:::0:0.0:8590.0:0.0:0.0:0.0:0.0:8600:-;-

查詢當前日期標的
hgetall etrade_target_summaries:0412
釋出當前資料
publish etrade.msg.channel 3:1460409223000:289.1

hgetall etrade_target_summaries:0412
Q、redis例子一些demo部落格
http://blog.csdn.net/songylwq/article/details/26008327

http://blog.163.com/asd_wll/blog/static/210310402013654528316/

Q、Redis無法啟動You may fix this problem by either reducing the size of the Redis heap with the –maxheap

解決方式一:不適用window安裝版,直接使用解壓縮版本
解決方式二:
檢視方法:可以選擇視窗啟動,也可以選cmd中啟動redis-server
在cmd中啟動立即停止,並且提示錯誤,此時手動加大堆記憶體
這裡寫圖片描述
解決方式:http://blog.csdn.net/testcs_dn/article/details/45220197