Redis使用以及下载(windows版本教程)_redis下载
方案一:使用微软维护的 Windows 版 Redis (v3.2.100)
下载步骤
-
访问 GitHub 发布页:
https://github.com/microsoftarchive/redis/releases -
下载安装包:
Redis-x64-3.2.100.msi
(64位系统)或Redis-x86-3.2.100.msi
(32位系统)
安装教程
-
双击
.msi
文件安装 -
勾选 \"Add Redis installation folder to PATH\"(添加环境变量)
-
完成安装后,Redis 会自动作为服务运行(可在服务管理器中查看
Redis
服务)
基本使用
redis-server
或通过服务管理器redis-cli
redis-cli
中输入 PING
,返回 PONG
SET mykey \"Hello\"
GET mykey
配置文件位置
默认路径:C:\\Program Files\\Redis\\redis.windows-service.conf
方案二:通过 WSL 安装最新版 Redis(推荐)
前置条件
-
启用 WSL(以管理员身份打开 PowerShell):
wsl --install
-
重启电脑后安装 Ubuntu 发行版(微软商店搜索 Ubuntu)
安装 Redis
-
打开 Ubuntu 终端
-
更新软件包并安装 Redis:
sudo apt update && sudo apt upgrade -ysudo apt install redis-server -y
配置与使用
-
启动 Redis 服务:
sudo service redis-server start
-
开机自启:
sudo systemctl enable redis-server
-
连接客户端:
redis-cli
从 Windows 访问 WSL 中的 Redis
-
获取 WSL 的 IP 地址(在 Ubuntu 中运行):
hostname -I
-
在 Windows 中使用 Redis 客户端连接:
redis-cli -h -p 6379
方案三:使用 Docker(跨平台通用)
-
安装 Docker Desktop for Windows
-
拉取 Redis 镜像:
docker pull redis
-
启动容器:
docker run --name my-redis -p 6379:6379 -d redis
-
连接客户端:
docker exec -it my-redis redis-cli
图形化管理工具推荐
-
RedisInsight (官方工具):Redis Insight
-
Another Redis Desktop Manager:https://github.com/qishibo/AnotherRedisDesktopManager
常见问题解决
-
端口冲突:修改
redis.conf
中的port 6379
并重启服务 -
认证配置:在配置文件中设置
requirepass yourpassword
-
WSL 连接失败:检查防火墙是否放行 6379 端口