windows无法启动redis-server

bash 复制代码
Warning: no config file specified, using the default config.
In order to specify a config file use D:\Code_enve\Redis\redis-server.exe /path/to/redis.conf
Creating Server TCP listening socket *:6379: bind: No such file or directory

以上是问题的报错信息,以下命令均在powershell进行

错误分析

  1. 配置文件未指定:系统警告你没有指定配置文件,因此它将使用默认配置。
  2. 绑定端口失败:Redis 尝试创建一个 TCP 监听套接字绑定到端口 6379 时失败,错误提示为"bind: No such file or directory"。

解决方法

检查端口占用情况
  • 在 Windows 上,你可以使用以下命令查看端口 6379 是否被占用:

    bash 复制代码
    netstat -ano | findstr :6379

    如果发现端口被占用,可以终止相关进程,或者配置 Redis 使用其他端口。

  • 使用 PowerShell 检查和配置防火墙(需要以管理员身份)

    • 检查端口状态:
bash 复制代码
Get-NetFirewallRule -All | Where-Object { $_.DisplayName -like "*6379*" }

添加允许规则 :使用以下命令

bash 复制代码
New-NetFirewallRule -DisplayName "允许 Redis 6379 端口" -Direction Inbound -Protocol TCP -LocalPort 6379 -Action Allow

验证端口连通性

bash 复制代码
Test-NetConnection -ComputerName 127.0.0.1 -Port 6379
指定配置文件:

通过指定 redis.windows.conf 配置文件,Redis 能够正确读取并应用配置项,例如端口号、绑定地址等,避免了默认配置可能带来的问题。

1.输入redis-cli.exe

2.再输入shutdown 结束,此时redis 会显示 not connected

3.最后输入 exit 退出

4.再次输入 redis-server.exe redis.windows.conf 启动redis命令就可以启动成功!(这里要在你配置redis的目录,否则会像如下显示,输入绝对路径是可以的)

相关推荐
zl97989911 分钟前
Redis-缓存问题(穿透、击穿、雪崩)
redis
白云偷星子14 分钟前
MySQL笔记14
数据库·笔记·mysql
绵绵细雨中的乡音1 小时前
MySQL 常用函数实操指南:从基础到实战案例
数据库·mysql
凉栀お_2 小时前
MySQL相关知识查询表中内容(第二次作业)
数据库·mysql
ss2732 小时前
手写Spring第7弹:Spring IoC容器深度解析:XML配置的完整指南
java·前端·数据库
PFinal社区_南丞3 小时前
PostgreSQL-10个鲜为人知的强大功能
数据库·后端
misty youth3 小时前
配置openguass 教程(自存)
数据库·ubuntu·华为·openguass
瑞士卷@4 小时前
MyBatis入门到精通(Mybatis学习笔记)
java·数据库·后端·mybatis
白云偷星子4 小时前
MySQL笔记13
数据库·笔记·mysql
施嘉伟4 小时前
静默安装金仓数据库,到底有多简单?
数据库