Redis对于Linux是官方支持的,安装和使用没有什么好说的,普通使用按照官方指导,5分钟以内就能搞定。详情请参考:

http://redis.io/download

但有时候又想在windows下折腾下Redis,可以从redis下载页面看到如下提示:

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

下载解压,没什么好说的,在解压后的bin目录下有以下这些文件:

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种方法

网上参考了一些资料,发觉可以使用,也就没有深究,直接拿来主义:

启动脚本如下:

redis-server  redis.windows.conf

可以将其保存为文件 startup.bat ; 下次就可以直接启动了。

但是在cmd之中执行这行命令之后报错:

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 , 然后直接指定好内容即可.

.......
#
# maxheap <bytes>
maxheap 1024000000
.......

然后再次启动,OK,成功.

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命令:

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查看,例如:

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

redis-server.exe --service-install redis.windows.conf --loglevel verbose

uninstall-service.bat

redis-server --service-uninstall

startup.bat

        redis-server.exe redis.windows.conf

Windows下安装并设置Redis的更多相关文章

  1. windows下安装和配置redis

    1.windows下安装和配置redis 1.1 下载: 官网(linux下载地址):https://redis.io/ Windows系统下载地址:https://github.com/MSOpen ...

  2. windows下安装,配置redis以及可视化客户端redisClient的安装及基本使用

    一. Window 下安装 下载地址:https://github.com/MSOpenTech/redis/releases. Redis 支持 32 位和 64 位.这个需要根据你系统平台的实际情 ...

  3. windows下安装并使用redis

    一.安装前首先了解一下phpinfo里面的一些信息,能否正确安装非常有帮助. (下图是我的本机环境) compiler :编译器 Architecture :CPU架构 Configuration F ...

  4. composer在windows下安装并且设置全局变量

    Composer是 PHP 用来管理依赖(dependency)关系的工具.你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会帮你安装这些依赖的库文件. 1丶使用安 ...

  5. windows下安装和设置gradle

    一.安装前检查 检查jdk是否已经安装 二.下载gradle 1. https://gradle.org/releases/ 2.设置gradle环境变量 3. 环境变量中增加名为GRADLE_HOM ...

  6. Windows下安装和破解redis desktopmanager 2019.4

    redis可视化客户端工具:redis desktop manager 破解版链接:https://www.52pojie.cn/thread-1042770-1-1.html redis deskt ...

  7. windows 下安装redis并且测试(php)

    Window 下安装 下载地址:https://github.com/dmajkic/redis/downloads. 下载到的Redis支持32bit和64bit.根据自己实际情况选择,将64bit ...

  8. windows下安装redis以及测试

    Window 下安装 下载地址:https://github.com/dmajkic/redis/downloads. 下载到的Redis支持32bit和64bit.根据自己实际情况选择,将64bit ...

  9. windows下安装redis以及测试 --转载自http://www.cnblogs.com/lpyan/p/5608333.html

    redis加入到Windows 服务 以下方式,需要在redis-2.8.24下执行:http://download.csdn.net/download/feiliua/9425770 ,另外php的 ...

随机推荐

  1. 2012 #5 History repeat itself

    History repeat itself Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I6 ...

  2. Object-C: 枚举

    摘自:http://coffeeandsandwich.com/?p=8 在 iOS 6 和 Mac OS X 10.8 以前,定义枚举类型的方式如下: typedef enum the_enum_n ...

  3. “System.Data.OracleClient.OracleConnection”已过时

    处理办法: 在oracle 安装目录下 找到 Oracle.DataAccess.dll添加引用,然后 using Oracle.DataAccess.Client;其他的都不用动,即可.连接字符串中 ...

  4. Github上不错的Android开源代码(一)

    总有一些朋友很热心的整理一些好的资料,在收集之后,可以用作阅读.学习和实践.小伙伴们,总有一天,你也能写出 Niubility 的 Android App :-) 为了防止以上链接失效,以及部分内容丢 ...

  5. 对List中对象的去重

    今天项目中遇到了一个对List中对象去重的问题. 首先对于我们自己系统中的对象我们只要重写该对象的 equal 和 hashcode 即可(利用对象中的能够唯一确定对象的属性). 但是我遇到的不是本系 ...

  6. iOS - UITextView

    前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UITextView : UIScrollView <UITextInput> @available(i ...

  7. poj1375Intervals(点到圆的切线)

    链接 貌似这样的叫解析几何 重点如何求得过光源到圆的切线与地板的交点x坐标,可以通过角度及距离来算,如图, 根据距离和半径可以求得角度a.b.r,自然也可以求得d1,d2. 至于方向问题,在求r得时候 ...

  8. 线程高级应用-心得6-java5线程并发库中同步工具类(synchronizers),新知识大用途

    1.新知识普及 2. Semaphore工具类的使用案例 package com.java5.thread.newSkill; import java.util.concurrent.Executor ...

  9. Lua了解 & 为什么游戏开发用Lua

    参考这篇文章 https://www.zhihu.com/question/21717567 看来就是网易风云为了让人写外挂不方便而采用的冷门语言.当然冷门的语言不代表不好用啦. Lua 虚拟机小,嵌 ...

  10. PSR-0的规范。