.NET中使用Redis总结 —— 1.Redis搭建
注:關(guān)于如何在windows,linux下配置redis,詳見這篇文章:)??
下載地址:http://redis.io/download?
Redis官方是不支持windows的,只是?Microsoft Open Tech group 在 GitHub上開發(fā)了一個(gè)Win64的版本,項(xiàng)目地址是:
https://github.com/MSOpenTech/redis/releases?
本文使用的Redis 版本為2.8.19
文件介紹:
redis-benchmark.exe???????? #基準(zhǔn)測試
redis-check-aof.exe? ? ? ? ? ?# aof
redischeck-dump.exe??????? # dump
redis-cli.exe? ? ? ? ? ? ? ? ? ? ? ?# 客戶端
redis-server.exe? ? ? ? ? ? ? ? # 服務(wù)器
redis.windows.conf? ? ? ? ? ?# 配置文件 redis.conf配置詳細(xì)解析
安裝
windows 運(yùn)行,啟動(dòng)遇到問題
使用命令【redis-server.exe redis.windows.conf】,啟動(dòng)redis 服務(wù)【如果您沒出現(xiàn)如下的錯(cuò)誤,直接跳過】。如果您也像我一樣出現(xiàn)如下的錯(cuò)誤,不用急,總有解決辦法滴!解決辦法:根據(jù)提示,是 maxheap 標(biāo)識(shí)有問題,打開配置文件 redis.windows.conf ,搜索 maxheap , 然后直接指定好內(nèi)容即可.......# # maxheap <bytes>maxheap 1024000000.......然后再次啟動(dòng),OK,成功.?
再次運(yùn)行出現(xiàn)這個(gè)界面那說明啟動(dòng)成功了。
?重新打開命令提示符測試下。
?
安裝成windows服務(wù),將文件類型改為bat格式
redis-server --service-install redis.windows.conf --service-name redisService6379當(dāng)然卸載服務(wù)也一樣
redis-server --service-uninstall redis.windows.conf --service-name redisService6379遇到的問題
redis 允許外網(wǎng)訪問
解決方案:?redis默認(rèn)只允許本地訪問 ,修改redis.windows.conf文件中的??bind 127.0.0.1 ? 修改為 ? bind ?0.0.0.0? 重啟Redis服務(wù)
常用命令
- set key value 插入鍵
- get key 獲取value
- keys * 查詢所有鍵
- del key 刪除鍵
- flushall 清空數(shù)據(jù)庫
- flushdb 刪除當(dāng)前數(shù)據(jù)庫中的所有Key
- flushall 刪除所有數(shù)據(jù)庫中的key
連接操作相關(guān)的命令
- quit:關(guān)閉連接(connection)
- auth:簡單密碼認(rèn)證
- info clients 查詢連接數(shù)
- config get maxclients 可以查詢r(jià)edis允許的最大連接數(shù)
?
?參考
-
RedisHelper
-
Redis起步
-
ServiceStackRedis
-
Windows下安裝并設(shè)置Redis?
轉(zhuǎn)載于:https://www.cnblogs.com/bigbrid/p/6137515.html
總結(jié)
以上是生活随笔為你收集整理的.NET中使用Redis总结 —— 1.Redis搭建的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sql server 2008 学习笔记
- 下一篇: 综合应用WPF/WCF/WF/LINQ之