Redis在windows下的配置(在windows-64下安裝redis,請參考微軟redis的github:https://github.com/MSOpenTech/redis/releases)
下面是windows32的配置
假設安裝目錄為E:\wrcold520\Redis-3.2.100-Windows-32\Redis
1、啟動沒有參數配置的Redis:
(1)輕按兩下redis-server.exe
(2)在cmd指令視窗下運作redis-server或者redis-server.exe
# 示例:
Microsoft Windows [版本 6.1.7601]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。
E:\wrcold520\Redis-3.2.100-Windows-32\Redis>redis-server
[6788] 10 Feb 13:47:38.750 # Warning: no config file specified, using the defaul
t config. In order to specify a config file use redis-server /path/to/redis.conf
[6788] 10 Feb 13:47:38.753 # Warning: 32 bit instance detected but no memory lim
it set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.0.504 (00000000/0) 32 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 6788
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[6788] 10 Feb 13:47:38.755 # Server started, Redis version 3.0.504
[6788] 10 Feb 13:47:38.755 * DB loaded from disk: 0.000 seconds
[6788] 10 Feb 13:47:38.756 * The server is now ready to accept connections on po
rt 6379
2、帶配置檔案啟動Redis
在cmd指令視窗下運作:redis-server redis.windows.conf或者redis-server.exe redis.windows.conf
# 示例:
Microsoft Windows [版本 6.1.7601]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。
E:\wrcold520\Redis-3.2.100-Windows-32\Redis>redis-server redis.windows.conf
[7540] 10 Feb 13:43:07.046 # Warning: 32 bit instance detected but no memory lim
it set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.0.504 (00000000/0) 32 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 7540
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[7540] 10 Feb 13:43:07.047 # Server started, Redis version 3.0.504
[7540] 10 Feb 13:43:07.048 * DB loaded from disk: 0.000 seconds
[7540] 10 Feb 13:43:07.048 * The server is now ready to accept connections on po
rt 6379
3、将redis加入windows服務
(1)在cmd指令視窗下運作:redis-server.exe --service-install redis.windows.conf --loglevel verbose
### 示例:
Microsoft Windows [版本 6.1.7601]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。
E:\wrcold520\Redis-3.2.100-Windows-32\Redis>redis-server.exe --service-install r
edis.windows.conf --loglevel verbose
[7776] 10 Feb 13:56:21.950 # Granting read/write access to 'NT AUTHORITY\Network
Service' on: "E:\wrcold520\Redis-3.2.100-Windows-32\Redis" "E:\wrcold520\Redis-3
.2.100-Windows-32\Redis\"
[7776] 10 Feb 13:56:21.950 # Redis successfully installed as a service.
(2)啟動redis服務
在cmd指令視窗下運作:redis-server --service-start
### 示例:
E:\wrcold520\Redis-3.2.100-Windows-32\Redis>redis-server --service-start
[6780] 10 Feb 14:05:18.046 # Redis service successfully started.
(3)關閉redis服務
在cmd指令視窗下運作:redis-server --service-stop
### 示例:
E:\wrcold520\Redis-3.2.100-Windows-32\Redis>redis-server --service-stop
[1660] 10 Feb 14:05:28.098 # Redis service successfully stopped.
4、移除redis的windows服務
在cmd指令視窗下運作:redis-server --service-uninstall
### 示例:
E:\wrcold520\Redis-3.2.100-Windows-32\Redis>redis-server --service-uninstall
[4744] 10 Feb 13:59:18.735 # Redis service successfully uninstalled.
開啟遠端通路
Redis安裝完之後,在服務中可以看到對應的Redis服務,打開屬性,可以看到“可執行檔案的路徑”是:”D:\Program Files\Redis\redis-server.exe” –service-run “D:\Program Files\Redis\redis.windows-service.conf”
開啟Redis遠端通路的步驟如下:
打開redis.windows-service.conf
找到“bind 127.0.0.1”改為bing 0.0.0。0
找到“protected-mode yes”并改為“protected-mode no”
增加叢集部署後,出現如下bug
@ERR Unsupported CONFIG parameter: notify-keyspace-events
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Unsupported CONFIG parameter: notify-keyspace-events
at redis.clients.jedis.Protocol.processError(Protocol.java:113)
at redis.clients.jedis.Protocol.process(Protocol.java:131)
at redis.clients.jedis.Protocol.read(Protocol.java:200)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:285)
at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:184)
at redis.clients.jedis.Jedis.configSet(Jedis.java:2797)
at org.springframework.data.redis.connection.jedis.JedisConnection.setConfig(JedisConnection.java:616)
... 30 more
解決方案:
更換redis版本為2.8以上
@EnableRedisHttpSession requires Redis 2.8.0+
Redis 安裝系統服務報錯 HandleServiceCommands: system error caught. error c ode=1073, message = CreateS
原因:系統服務中已經存在
解決辦法: