Windows10下Redis服务无法启动求助(依赖Django Channels_redis)
Hey there! Let’s work through this Redis problem together—since you need it for Django Channels, we’ll get it up and running in no time. Let’s break down what’s causing each error and how to fix them.
First, Understand the Errors
Let’s start with the two issues you’re seeing:
- When running
redis-server redis.windows.conf, you getCreating Server TCP listening socket 127.0.0.1:6379: bind: No error— this usually means the bind operation itself didn’t fail, but something else is stopping Redis from fully starting (most often a port conflict or missing directory). - When running just
redis-server, you getbind: No such file or directory— this is a common Windows Redis issue related to missing directories for persistent storage.
Step-by-Step Fixes
1. Make Sure You’re in the Right Directory
Redis needs to be run from its installation/unzip folder. Open Command Prompt (CMD) and navigate to your Redis directory first:
cd C:\path\to\your\redis\folder
(Replace the path with where you installed/unzipped Redis, like C:\Redis.)
2. Fix the "No such file or directory" Error
This happens because Redis can’t create its persistence file (dump.rdb) in the default directory. Here’s how to fix it:
- Create a new folder named
datainside your Redis directory. - Open the
redis.windows.conffile in a text editor, find thedirline (it looks likedir .), and change it to point to your newdatafolder:dir C:\path\to\your\redis\folder\data - Save the config file and close it.
3. Check if Port 6379 is Occupied
The "No error" message might hide a port conflict—another program could be using port 6379. To check:
Run this command in CMD:
netstat -ano | findstr :6379
- If you see output, note the PID number at the end of the line.
- Open Task Manager, go to the Details tab, find the process with that PID, right-click it, and select End Task.
4. Start Redis Correctly
Now go back to your Redis directory in CMD and run:
redis-server redis.windows.conf
If everything works, you’ll see a message like * Ready to accept connections — that means Redis is running!
5. Verify the Connection
To make sure Redis is working properly, open a new CMD window, navigate to your Redis directory, and run:
redis-cli
Then type ping and press Enter. If you get PONG in response, you’re good to go—Django Channels can now connect to Redis.
Extra Tip
If you still run into issues, try running CMD as Administrator. Sometimes Windows permissions prevent Redis from creating files or binding to ports properly.
内容的提问来源于stack exchange,提问作者Bryar

