Redis安装配置

Redis 官方对于Windows平台并没有支持,不过微软有专门的团队在做。

Linux平台安装###

使用按照官方指导,即可。详情请参考这里

Windows平台安装###

Windows下面安装其实也不是很难,和Mongodb差不多,无非就是配置基本运行参数和服务。
该平台下的 redis 由 Microsoft Open Tech group 支持:https://github.com/MSOpenTech/redis

无论是msi 安装文件或.zip文件或源码其实都是一样的,下载解压后 有以下文件:

配置redis:

  • . 设置maxheap: 打开redis.windows.conf文件(其中msi安装时会引导配置),添加以下内容:

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

启动脚本:

redis-server  redis.windows.conf  

可以将其保存为文件 startup.bat ; 下次就可以直接启动了。
然后再次启动,OK,成功

D:Redis>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

在我机器上运行上述命令一直报错:

Creating Server TCP listening socket *:6379: bind: No such file or directory

输入以下命令后,再运行上面的命令就没有问题了:

redis-cli.exe
shutdown
exit
redis-server.exe

附件:

  1. Redis本地环境搭建
  2. 配置文件详解
  3. 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

参考###

原文地址:https://www.cnblogs.com/nju2014/p/5426804.html