Windows下安装并设置Redis
2017-03-01 14:37
501 查看
作者: 铁锚
日期: 2014年8月10日
Redis对于Linux是官方支持的,安装和使用没有什么好说的,普通使用按照官方指导,5分钟以内就能搞定。详情请参考:
http://redis.io/download
但有时候又想在windows下折腾下Redis,可以从redis下载页面看到如下提示(在页面中搜索 "windows"):
[plain]
view plain
copy
Win64 Unofficial The Redis project does not directly support Windows,
however the Microsoft Open Tech group develops and maintains
an Windows port targeting Win64.
大意就是 Redis官方是不支持windows的,只是 Microsoft Open Tech group 在 GitHub上开发了一个Win64的版本,项目地址是:
https://github.com/MSOpenTech/redis
打开以后,可以直接使用浏览器下载,或者Git克隆。
可以在项目主页右边找到 zip包下载地址: https://github.com/MSOpenTech/redis/archive/2.8.zip
(注意: dist文件改变了下载地址: https://github.com/MSOpenTech/redis/releases )
在 Release 页面中,可以找到 msi 安装文件以及 .zip 文件(而且有3.0的beta版,请下拉查找)。
下载解压,没什么好说的,在解压后的bin目录下有以下这些文件:
[plain]
view plain
copy
redis-benchmark.exe #基准测试
redis-check-aof.exe # aof
redis-check-dump.exe # dump
redis-cli.exe # 客户端
redis-server.exe # 服务器
redis.windows.conf # 配置文件
当然,还有一个 RedisService.docx 文件,看似是一些启动和安装服务的说明文档,但是照着他的指示来,你就会死的很惨,莫名其妙的死了,不知道原因。
【换机器重新测试后已查明,如果不是Administrator用户,就会出各种问题,服务安装以后启动不了等等问题,应该可以修改服务的属性-->登录用户等选项来修正.】
【如果你安装的windows没有Administrator账户,请参考这篇文章:
】
网上参考了一些资料,发觉可以使用,也就没有深究,直接拿来主义:
启动脚本如下:
[plain]
view plain
copy
redis-server redis.windows.conf
可以将其保存为文件 startup.bat ; 下次就可以直接启动了。
但是在cmd之中执行这行命令之后报错:
[plain]
view plain
copy
D:\Develop\redis-2.8.12>redis-server.exe redis.windows.conf
[7736] 10 Aug 21:39:42.974 #
The Windows version of Redis allocates a large memory mapped file for sharing
the heap with the forked process used in persistence operations. This file
will be created in the current working directory or the directory specified by
the 'dir' directive in the .conf file. Windows is reporting that there is
insufficient disk space available for this file (Windows error 0x70).
You may fix this problem by either reducing the size of the Redis heap with
the --maxheap flag, or by starting redis from a working directory with
sufficient space available for the Redis heap.
Please see the documentation included with the binary distributions for more
details on the --maxheap flag.
Redis can not continue. Exiting.
根据提示,是 maxheap 标识有问题,打开配置文件 redis.windows.conf ,搜索 maxheap , 然后直接指定好内容即可.
[plain]
view plain
copy
.......
#
# maxheap <bytes>
maxheap 1024000000
.......
然后再次启动,OK,成功.
[plain]
view plain
copy
D:\Develop\redis-2.8.12>redis-server redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.12 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 6736
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[6736] 10 Aug 22:01:22.247 # Server started, Redis version 2.8.12
[6736] 10 Aug 22:01:22.248 * The server is now ready to accept connections on port 6379
然后可以使用自带的客户端工具进行测试。
双击打开 redis-cli.exe , 如果不报错,则连接上了本地服务器,然后测试,比如 set命令,get命令:
[plain]
view plain
copy
127.0.0.1:6379> set tiemao http://blog.csdn.net/renfufei
OK
127.0.0.1:6379> get tiemao
"http://blog.csdn.net/renfufei"
127.0.0.1:6379>
这应该很好理解,连接上了本机的6379端口。
如果需要帮助,可以在 cli窗口中输入 help查看,例如:
[plain]
view plain
copy
127.0.0.1:6379> help
redis-cli 2.8.12
Type: "help @<group>" to get a list of commands in <group>
"help <command>" for help on <command>
"help <tab>" to get a list of possible help topics
"quit" to exit
127.0.0.1:6379> help @string
根据提示,可以输入 help 空格 然后敲tab键,可以像命令提示一样告诉你可以有哪些帮助分组,多敲几个 tab 试试?
备注说明:
1. 这个版本是Win64的,所以32位windows就不要折腾了。
2. 我的操作系统是Windows 7 64位旗舰版,运行内存16GB,用户不是Administrator,而是 hasee,所以设置了下 redis-server.exe 和redis-cli.exe
的属性中的兼容性权限(以管理员身份运行),如果你运行出错,可能需要设置一下这里。
3. 什么360啊,UAC啊,防火墙啊,该关的请关闭。。。
4. 如果有其他问题,欢迎留言或者评论, 这只是一个心血来潮时的折腾
接触了好久Redis但一直没在windows下使用,请轻拍。
附加几个 bat 批处理脚本,请根据需要灵活配置
service-install.bat
[plain]
view plain
copy
redis-server.exe --service-install redis.windows.conf --loglevel verbose
uninstall-service.bat
[plain]
view plain
copy
redis-server --service-uninstall
startup.bat
[plain]
view plain
copy
redis-server.exe redis.windows.conf
更多信息,请参考: Redis本地环境搭建.md
2.
Redis官网下载页面: http://redis.io/download
Windows下Redis项目: https://github.com/MSOpenTech/redis
在releases页面找到并下载最新的ZIP包: https://github.com/MSOpenTech/redis/releases
3.
加压下载后的文件
如果需要简单测试一下, 鼠标双击
如果不是 Administrator用户,则可能需要以管理员身份运行. 或者参考
Windows 7 启用超级管理员administrator账户的N种方法
简单测试,则使用
如果要进行基准测试,可以启动服务器后,在
4.
如果准备长期使用,则需要注册为系统服务.
进入CMD,切换目录:
注册服务,可以保存为
卸载服务, 可以保存为
可以在注册服务时,通过
启动redis服务器时也可以直接指定配置文件,可以保存为
当然,指定了配置文件以后,可能会碰到启动失败的问题.此时,请修改配置文件,指定
5.
修改配置文件
此时,如果用客户端来访问,使用如下cmd命令,可以保存为
6.
管理工具: RedisStudio: https://github.com/cinience/RedisStudio
当然,目录里面也有一些word文档, 有兴趣可以读一读.
更多信息,请参考:
renfufei的专栏-Redis: http://blog.csdn.net/renfufei/article/category/2470713
我在这个群里,该群有大量高手潜伏,欢迎加入: 点击链接加入群【redis两千人总群】
日期: 2014年8月10日
Redis对于Linux是官方支持的,安装和使用没有什么好说的,普通使用按照官方指导,5分钟以内就能搞定。详情请参考:
http://redis.io/download
但有时候又想在windows下折腾下Redis,可以从redis下载页面看到如下提示(在页面中搜索 "windows"):
[plain]
view plain
copy
Win64 Unofficial The Redis project does not directly support Windows,
however the Microsoft Open Tech group develops and maintains
an Windows port targeting Win64.
大意就是 Redis官方是不支持windows的,只是 Microsoft Open Tech group 在 GitHub上开发了一个Win64的版本,项目地址是:
https://github.com/MSOpenTech/redis
打开以后,可以直接使用浏览器下载,或者Git克隆。
可以在项目主页右边找到 zip包下载地址: https://github.com/MSOpenTech/redis/archive/2.8.zip
(注意: dist文件改变了下载地址: https://github.com/MSOpenTech/redis/releases )
在 Release 页面中,可以找到 msi 安装文件以及 .zip 文件(而且有3.0的beta版,请下拉查找)。
下载解压,没什么好说的,在解压后的bin目录下有以下这些文件:
[plain]
view plain
copy
redis-benchmark.exe #基准测试
redis-check-aof.exe # aof
redis-check-dump.exe # dump
redis-cli.exe # 客户端
redis-server.exe # 服务器
redis.windows.conf # 配置文件
当然,还有一个 RedisService.docx 文件,看似是一些启动和安装服务的说明文档,但是照着他的指示来,你就会死的很惨,莫名其妙的死了,不知道原因。
【换机器重新测试后已查明,如果不是Administrator用户,就会出各种问题,服务安装以后启动不了等等问题,应该可以修改服务的属性-->登录用户等选项来修正.】
【如果你安装的windows没有Administrator账户,请参考这篇文章:
Windows 7 启用超级管理员administrator账户的N种方法
】网上参考了一些资料,发觉可以使用,也就没有深究,直接拿来主义:
启动脚本如下:
[plain]
view plain
copy
redis-server redis.windows.conf
可以将其保存为文件 startup.bat ; 下次就可以直接启动了。
但是在cmd之中执行这行命令之后报错:
[plain]
view plain
copy
D:\Develop\redis-2.8.12>redis-server.exe redis.windows.conf
[7736] 10 Aug 21:39:42.974 #
The Windows version of Redis allocates a large memory mapped file for sharing
the heap with the forked process used in persistence operations. This file
will be created in the current working directory or the directory specified by
the 'dir' directive in the .conf file. Windows is reporting that there is
insufficient disk space available for this file (Windows error 0x70).
You may fix this problem by either reducing the size of the Redis heap with
the --maxheap flag, or by starting redis from a working directory with
sufficient space available for the Redis heap.
Please see the documentation included with the binary distributions for more
details on the --maxheap flag.
Redis can not continue. Exiting.
根据提示,是 maxheap 标识有问题,打开配置文件 redis.windows.conf ,搜索 maxheap , 然后直接指定好内容即可.
[plain]
view plain
copy
.......
#
# maxheap <bytes>
maxheap 1024000000
.......
然后再次启动,OK,成功.
[plain]
view plain
copy
D:\Develop\redis-2.8.12>redis-server redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.12 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 6736
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[6736] 10 Aug 22:01:22.247 # Server started, Redis version 2.8.12
[6736] 10 Aug 22:01:22.248 * The server is now ready to accept connections on port 6379
然后可以使用自带的客户端工具进行测试。
双击打开 redis-cli.exe , 如果不报错,则连接上了本地服务器,然后测试,比如 set命令,get命令:
[plain]
view plain
copy
127.0.0.1:6379> set tiemao http://blog.csdn.net/renfufei
OK
127.0.0.1:6379> get tiemao
"http://blog.csdn.net/renfufei"
127.0.0.1:6379>
这应该很好理解,连接上了本机的6379端口。
如果需要帮助,可以在 cli窗口中输入 help查看,例如:
[plain]
view plain
copy
127.0.0.1:6379> help
redis-cli 2.8.12
Type: "help @<group>" to get a list of commands in <group>
"help <command>" for help on <command>
"help <tab>" to get a list of possible help topics
"quit" to exit
127.0.0.1:6379> help @string
根据提示,可以输入 help 空格 然后敲tab键,可以像命令提示一样告诉你可以有哪些帮助分组,多敲几个 tab 试试?
备注说明:
1. 这个版本是Win64的,所以32位windows就不要折腾了。
2. 我的操作系统是Windows 7 64位旗舰版,运行内存16GB,用户不是Administrator,而是 hasee,所以设置了下 redis-server.exe 和redis-cli.exe
的属性中的兼容性权限(以管理员身份运行),如果你运行出错,可能需要设置一下这里。
3. 什么360啊,UAC啊,防火墙啊,该关的请关闭。。。
4. 如果有其他问题,欢迎留言或者评论, 这只是一个心血来潮时的折腾
接触了好久Redis但一直没在windows下使用,请轻拍。
附加几个 bat 批处理脚本,请根据需要灵活配置
service-install.bat
[plain]
view plain
copy
redis-server.exe --service-install redis.windows.conf --loglevel verbose
uninstall-service.bat
[plain]
view plain
copy
redis-server --service-uninstall
startup.bat
[plain]
view plain
copy
redis-server.exe redis.windows.conf
更多信息,请参考: Redis本地环境搭建.md
Redis本地环境搭建
Windows 下环境搭建
1. 设置hosts
set duapphosts=127.0.0.1 sqld.duapp.com set redisduapphosts=127.0.0.1 redis.duapp.com echo %duapphosts% >> C:\Windows\System32\drivers\etc\hosts echo %redisduapphosts% >> C:\Windows\System32\drivers\etc\hosts
2.
下载Redis-Windows版本
Redis官网下载页面: http://redis.io/downloadWindows下Redis项目: https://github.com/MSOpenTech/redis
在releases页面找到并下载最新的ZIP包: https://github.com/MSOpenTech/redis/releases
3.
解压安装
加压下载后的文件 redis-2.8.17.zip到 redis-2.8.17 目录. 例如:
D:\DevlopPrograms\redis-2.8.17.
如果需要简单测试一下, 鼠标双击
redis-server.exe即可,如果没错, 稍后会弹出命令行窗口显示执行状态.
如果不是 Administrator用户,则可能需要以管理员身份运行. 或者参考
Windows 7 启用超级管理员administrator账户的N种方法
简单测试,则使用
redis-cli.exe即可, 打开后会自动连接上本机服务器. 可以输入
info查看服务器信息.
如果要进行基准测试,可以启动服务器后,在
cmd中运行
redis-benchmark.exe程序.
4.
启动与注册服务
如果准备长期使用,则需要注册为系统服务.进入CMD,切换目录:
D: cd D:\DevlopPrograms\redis-2.8.17
注册服务,可以保存为
service-install.bat文件:
redis-server.exe --service-install redis.windows.conf --loglevel verbose redis-server --service-start
卸载服务, 可以保存为
uninstall-service.bat文件.:
redis-server --service-stop redis-server --service-uninstall
可以在注册服务时,通过
–service-name redisService1参数直接指定服务名,适合安装多个实例的情况,卸载也是同样的道理.
启动redis服务器时也可以直接指定配置文件,可以保存为
startup.bat文件:
redis-server.exe redis.windows.conf
当然,指定了配置文件以后,可能会碰到启动失败的问题.此时,请修改配置文件,指定
maxheap参数.
5.
修改配置文件
修改配置文件redis.windows.conf,如果有中文,请另存为
UTF-8编码.
# 修改端口号 # port 6379 port 80 # 指定访问密码 # requirepass foobared requirepass 6EhSiGpsmSMRyZieglUImkTr-eoNRNBgRk397mVyu66MHYuZDsepCeZ8A-MHdLBQwQQVQiHBufZbPa # 设置最大堆内存限制,两者设置一个即可 # maxheap <bytes> maxheap 512000000 # 设置最大内存限制, 两者设置一个即可 # maxmemory <bytes> # maxmemory 512000000
此时,如果用客户端来访问,使用如下cmd命令,可以保存为
client.bat文件:
redis-cli.exe -h redis.duapp.com -p 80 -a 6EhSiGpsmSMRyZieglUImkTr-eoNRNBgRk397mVyu66MHYuZDsepCeZ8A-MHdLBQwQQVQiHBufZbPa
6.
其他附加
管理工具: RedisStudio: https://github.com/cinience/RedisStudio 当然,目录里面也有一些word文档, 有兴趣可以读一读.
更多信息,请参考:
renfufei的专栏-Redis: http://blog.csdn.net/renfufei/article/category/2470713
我在这个群里,该群有大量高手潜伏,欢迎加入: 点击链接加入群【redis两千人总群】
相关文章推荐
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis(转)
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- 在windows上安装redis并设置密码
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- redis 安装启动及设置密码<windows>
- Windows下安装并设置Redis
- Windows下安装并设置Redis