1:下载
在这里下载安装包。
2:解压
直接解压到某个目录就可以了。
3:临时服务方式启动
这种方式可以快速启动,但是不会添加到系统的服务中。
3.1:启动
D:\program_files\Redis-x64-2.8.2402>redis-server.exe redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.2402 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 24480
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[24480] 28 Oct 09:39:51.705 # Server started, Redis version 2.8.2402
[24480] 28 Oct 09:39:51.707 * The server is now ready to accept connections on port 6379
3.2:客户端连接测试
D:\program_files\Redis-x64-2.8.2402>redis-cli.exe -h 127.0.0.1 -p 6379
127.0.0.1:6379> set name dongshidaddy
OK
127.0.0.1:6379> get name
3.3:启用密码并测试
- 启用密码
将requirepass
放开注释,然后设置自己的密码就可以了,这里设置密码为12345678
。
requirepass 12345678
。 - 重启服务
ctrl+C
掉老窗口,然后重新执行启动命令即可!
D:\program_files\Redis-x64-2.8.2402>redis-server.exe redis.windows.conf
...
[24480] 28 Oct 09:49:22.780 # User requested shutdown...
[24480] 28 Oct 09:49:22.780 * Saving the final RDB snapshot before exiting.
[24480] 28 Oct 09:49:22.830 * DB saved on disk
[24480] 28 Oct 09:49:22.830 # Redis is now ready to exit, bye bye...
D:\program_files\Redis-x64-2.8.2402>redis-server.exe redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.2402 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 23828
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[23828] 28 Oct 09:51:33.699 # Server started, Redis version 2.8.2402
[23828] 28 Oct 09:51:33.699 * DB loaded from disk: 0.000 seconds
[23828] 28 Oct 09:51:33.700 * The server is now ready to accept connections on port 6379
- 连接
D:\program_files\Redis-x64-2.8.2402>redis-cli.exe -h 127.0.0.1 -p 6379
127.0.0.1:6379> set age 32
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 12345678
OK
127.0.0.1:6379> set age 32
OK
127.0.0.1:6379> get age
"32"
ctrl+C
停止服务,继续后续。
4:添加到服务
4.1:注册服务
D:\program_files\Redis-x64-2.8.2402>redis-server.exe --service-install redis.windows.conf --service-name dongshidaddy-redis-server --loglevel verbose
[2452] 28 Oct 09:59:19.506 # Granting read/write access to 'NT AUTHORITY\NetworkService' on: "D:\program_files\Redis-x64-2.8.2402" "D:\program_files\Redis-x64-2.8.2402\"
[2452] 28 Oct 09:59:19.507 # Redis successfully installed as a service.
注册成功后,通过win+r
->services.msc
查看服务。
4.2:启动服务
D:\program_files\Redis-x64-2.8.2402>redis-server.exe --service-start --service-name dongshidaddy-redis-server
[10508] 28 Oct 10:21:56.212 # Redis service successfully started.
4.2:连接测试
D:\program_files\Redis-x64-2.8.2402>redis-cli.exe -h 127.0.0.1 -p 6379
127.0.0.1:6379> set gender man
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 12345678
OK
127.0.0.1:6379> set gender man
OK
127.0.0.1:6379> get gender
"man"