> 技术文档 > Redis使用以及下载(windows版本教程)_redis下载

Redis使用以及下载(windows版本教程)_redis下载


方案一:使用微软维护的 Windows 版 Redis (v3.2.100)

下载步骤
  1. 访问 GitHub 发布页:
    https://github.com/microsoftarchive/redis/releases

  2. 下载安装包:
    Redis-x64-3.2.100.msi(64位系统)或 Redis-x86-3.2.100.msi(32位系统)

安装教程
  1. 双击 .msi 文件安装

  2. 勾选 \"Add Redis installation folder to PATH\"(添加环境变量)

  3. 完成安装后,Redis 会自动作为服务运行(可在服务管理器中查看 Redis 服务)

基本使用
操作 命令 启动 Redis 服务 redis-server 或通过服务管理器 连接 Redis 客户端 redis-cli 测试连接 在 redis-cli 中输入 PING,返回 PONG 设置键值 SET mykey \"Hello\" 获取键值 GET mykey
配置文件位置

默认路径:C:\\Program Files\\Redis\\redis.windows-service.conf


方案二:通过 WSL 安装最新版 Redis(推荐)

前置条件
  1. 启用 WSL(以管理员身份打开 PowerShell):

    wsl --install
  2. 重启电脑后安装 Ubuntu 发行版(微软商店搜索 Ubuntu)

安装 Redis
  1. 打开 Ubuntu 终端

  2. 更新软件包并安装 Redis:

    sudo apt update && sudo apt upgrade -ysudo apt install redis-server -y
    
    
配置与使用
  1. 启动 Redis 服务:

    sudo service redis-server start
    
    
  2. 开机自启:

    sudo systemctl enable redis-server
    
    
  3. 连接客户端:

    redis-cli
    
    
从 Windows 访问 WSL 中的 Redis
  1. 获取 WSL 的 IP 地址(在 Ubuntu 中运行):

    hostname -I
    
    
  2. 在 Windows 中使用 Redis 客户端连接:

    redis-cli -h  -p 6379
    
    

方案三:使用 Docker(跨平台通用)

  1. 安装 Docker Desktop for Windows

  2. 拉取 Redis 镜像:

    docker pull redis
    
    
  3. 启动容器:

    docker run --name my-redis -p 6379:6379 -d redis
    
    
  4. 连接客户端:

    docker exec -it my-redis redis-cli
    
    

图形化管理工具推荐

  1. RedisInsight (官方工具):Redis Insight

  2. Another Redis Desktop Manager:https://github.com/qishibo/AnotherRedisDesktopManager

常见问题解决

  1. 端口冲突:修改 redis.conf 中的 port 6379 并重启服务

  2. 认证配置:在配置文件中设置 requirepass yourpassword

  3. WSL 连接失败:检查防火墙是否放行 6379 端口