win安装redis并开机自启
时间: 2023-11-30 19:33:52 浏览: 155
好的,以下是在 Windows 上安装 Redis 并设置开机自启的步骤:
1. 下载 Redis for Windows
你可以在 https://github.com/microsoftarchive/redis/releases 上下载 Redis for Windows。建议下载最新版的 Redis-x64-xxx.zip 文件。
2. 解压 Redis 文件
将下载的 Redis-x64-xxx.zip 文件解压到你想要安装 Redis 的目录下,例如:C:\Redis。
3. 配置 Redis
在 Redis 的解压目录下,找到 redis.windows-service.conf 文件并重命名为 redis.conf。
打开 redis.conf 文件,在文件中找到 bind 127.0.0.1 这一行,将其注释掉或者改为 bind 0.0.0.0,这样 Redis 就可以被任何 IP 访问。
4. 安装 Redis 服务
以管理员身份运行 cmd,进入 Redis 的解压目录下的 src 文件夹,执行以下命令:
redis-server --service-install redis.windows-service.conf --loglevel verbose
5. 启动 Redis 服务
执行以下命令启动 Redis 服务:
redis-server --service-start
6. 设置 Redis 开机自启
执行以下命令设置 Redis 开机自启:
redis-server --service-install --service-name redis --port 6379 --loglevel verbose
注意:如果你修改了 Redis 的端口号,需要将上面命令中的端口号 6379 修改为你所设定的端口号。
7. 验证 Redis 是否正常运行
打开命令行窗口,执行以下命令:
redis-cli ping
如果返回 PONG,说明 Redis 已经成功安装并开机自启。
希望这些步骤对你有所帮助!
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)