Redis——Windows安装
Redis——Windows安装指南🚀
Redis是一款高性能的键值存储数据库,虽然官方推荐在Linux环境下运行,但在Windows上也能通过一些方法安装使用。下面介绍两种常见的Windows安装方式:
方法一:使用官方Windows版本(不推荐)⚠️
Redis官方从3.0版本开始不再支持Windows,但微软维护了一个Windows兼容版本:
```bash
1.下载RedisforWindows
访问https://github.com/microsoftarchive/redis/releases
2.解压下载的zip文件到C:redis
3.启动Redis服务器
cdC:redis
redis-server.exeredis.windows.conf
4.另开命令行窗口测试
redis-cli.exe
127.0.0.1:6379>setmykey"HelloRedis"
OK
127.0.0.1:6379>getmykey
"HelloRedis"
```
方法二:使用WSL2(推荐)👍
Windows10/11用户可以通过WSL2安装原生Linux版Redis:
```bash
1.启用WSL2功能
dism.exe/online/enable-feature/featurename:Microsoft-Windows-Subsystem-Linux/all/norestart
dism.exe/online/enable-feature/featurename:VirtualMachinePlatform/all/norestart
2.安装Ubuntu发行版
wsl--install-dUbuntu
3.在Ubuntu中安装Redis
sudoaptupdate
sudoaptinstallredis-server
4.启动Redis服务
sudoserviceredis-serverstart
5.测试连接
redis-cli
127.0.0.1:6379>ping
PONG
```
方法三:使用Docker(最灵活)🐳
```bash
1.安装DockerDesktopforWindows
https://www.docker.com/products/docker-desktop/
2.拉取Redis镜像
dockerpullredis
3.运行Redis容器
dockerrun--namemy-redis-p6379:6379-dredis
4.使用redis-cli连接
dockerexec-itmy-redisredis-cli
```
小贴士💡
-生产环境强烈建议使用Linux系统
-Windows版Redis性能较差且更新滞后
-记得设置密码保护你的Redis实例🔐
-可以使用RedisInsight作为GUI管理工具
希望这篇指南能帮助你在Windows上顺利使用Redis!🎉如有问题,欢迎查阅官方文档或社区讨论。
Redis是一款高性能的键值存储数据库,虽然官方推荐在Linux环境下运行,但在Windows上也能通过一些方法安装使用。下面介绍两种常见的Windows安装方式:
方法一:使用官方Windows版本(不推荐)⚠️
Redis官方从3.0版本开始不再支持Windows,但微软维护了一个Windows兼容版本:
```bash
1.下载RedisforWindows
访问https://github.com/microsoftarchive/redis/releases
2.解压下载的zip文件到C:redis
3.启动Redis服务器
cdC:redis
redis-server.exeredis.windows.conf
4.另开命令行窗口测试
redis-cli.exe
127.0.0.1:6379>setmykey"HelloRedis"
OK
127.0.0.1:6379>getmykey
"HelloRedis"
```
方法二:使用WSL2(推荐)👍
Windows10/11用户可以通过WSL2安装原生Linux版Redis:
```bash
1.启用WSL2功能
dism.exe/online/enable-feature/featurename:Microsoft-Windows-Subsystem-Linux/all/norestart
dism.exe/online/enable-feature/featurename:VirtualMachinePlatform/all/norestart
2.安装Ubuntu发行版
wsl--install-dUbuntu
3.在Ubuntu中安装Redis
sudoaptupdate
sudoaptinstallredis-server
4.启动Redis服务
sudoserviceredis-serverstart
5.测试连接
redis-cli
127.0.0.1:6379>ping
PONG
```
方法三:使用Docker(最灵活)🐳
```bash
1.安装DockerDesktopforWindows
https://www.docker.com/products/docker-desktop/
2.拉取Redis镜像
dockerpullredis
3.运行Redis容器
dockerrun--namemy-redis-p6379:6379-dredis
4.使用redis-cli连接
dockerexec-itmy-redisredis-cli
```
小贴士💡
-生产环境强烈建议使用Linux系统
-Windows版Redis性能较差且更新滞后
-记得设置密码保护你的Redis实例🔐
-可以使用RedisInsight作为GUI管理工具
希望这篇指南能帮助你在Windows上顺利使用Redis!🎉如有问题,欢迎查阅官方文档或社区讨论。
