关于redis:Windows下安装Redis

7次阅读

共计 1108 个字符,预计需要花费 3 分钟才能阅读完成。

Redis

Redis 的官网地址为:https://redis.io
因为官网拜访较为迟缓,因而你能够拜访 Redis 中文网:http://www.redis.net.cn/
Redis 装置教程能够参考:Redis 装置 | Redis 教程

装置步骤

一、下载 Redis

  1. 下载 Redis 压缩包:https://github.com/dmajkic/re…
  2. 下载结束后,解压缩即可间接应用。依据本人的理论状况抉择 32 位 /64 位。局部文件如下:

    • redis.windows.conf:配置文件
    • redis-cli.exe:redis 的客户端
    • redis-server.exe:redis 服务器端

二、运行服务器端

  1. 在 Redis 文件夹中关上命令行窗口,依据官网教程,运行以下命令:

    redis-server.exe redis.conf
  2. 若提醒Failed to open the .conf file: redis.conf CWD= 你的 Redis 门路,那是因为配置文件名为redis.windows.conf
    因而你须要在命令行输出的命令为:

    redis-server.exe redis.windows.conf
  3. 若呈现谬误提醒:# QForkMasterInit: system error caught. error code=0x00000070, message=CreateFileMapping failed.: no space on device,那是因为你的配置文件中没有设置 Redis 的最大内存。
    关上配置文件(redis.windows.conf),在文件开端增加以下两行:

    maxmemory 268435456
    maxheap 314572800

  4. 从新在命令行输出命令:

    redis-server.exe redis.windows.conf

    若呈现下图则示意服务器运行胜利:
    能够看到服务器端的端口号和过程号。

三、运行客户端

  1. 在 Redis 目录下开启 另一个 命令行窗口,输出以下命令:

    redis-cli.exe -h 127.0.0.1 -p 6379

    若呈现 127.0.0.1:6379> 则客户端开启胜利。

四、应用 Redis

  1. 应用 setget即可应用 Redis 存储键值对。如下:
    应用 set username shadowckk 存储了一个键名为 ”username”、键值为 ”shadowckk” 的键值对;
    再应用 get username 取出 ”username” 的值 ”shadowckk”。

参考资料

  1. Redis 装置 | Redis 教程
  2. QForkMasterInit: system error caught. error code=0x000005af, message=VirtualAllocEx failed.: unknown
正文完
 0