redis默认端口被wsl2占用导致各种问题,wsl2上运行redis也不行。。改端口才行
关键原因是: windows系统级保留端口范围包括了 6379 这个 redis默认端口
netsh interface ipv4 show excludedportrange protocol=tcp
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
80 80
443 443
6081 6180
6181 6280
6287 6386
50000 50059 *
50128 50128
50131 50131
* - Administered port exclusions.
而这个端口占用常规的 netstat命令检查不出来, Get-NetTCPConnection -LocalPort 6379也不行, 返回都是空值
其使到 wsl2中间去运行 reis 也会报错,原因不详(不知是否跟自己体系上装有 virtualbox, WSA(Windows sub system for Android)、 应用宝 for windows有关)
sudo redis-server --bind 0.0.0.0 --protected-mode no --por
t 6379
[sudo] password for euse:
455:C 20 Jun 2025 11:54:28.222 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
455:C 20 Jun 2025 11:54:28.222 # Redis version=7.0.15, bits=64, commit=00000000, modified=0, pid=455, just started
455:C 20 Jun 2025 11:54:28.222 # Configuration loaded
455:M 20 Jun 2025 11:54:28.223 * Increased maximum number of open files to 10032 (it was originally set to 1024).
455:M 20 Jun 2025 11:54:28.223 * monotonic clock: POSIX clock_gettime
455:M 20 Jun 2025 11:54:28.226 # Warning: Could not create server TCP listening socket 0.0.0.0:6379: bind: Address already in use
455:M 20 Jun 2025 11:54:28.226 # Failed listening on port 6379 (TCP), aborting.
最后没有办法只能修改 Windows 主机上的 redis默认端口, 问题解决
浙公网安备 33010602011771号