DEV Community

Recca Tsai
Recca Tsai

Posted on • Originally published at recca0120.github.io

Fix Redis Connection Refused After Upgrading to 6.0

Originally published at recca0120.github.io

Problem

After upgrading Redis to 6.0.5, connecting with redis-cli threw this error:

Could not connect to Redis at 127.0.0.1:6379: Connection refused
Enter fullscreen mode Exit fullscreen mode

Starting from Redis 6.0, the default configuration binds to specific network interfaces, and protected-mode defaults to yes, which blocks even localhost connections.

Solution

Edit redis.conf and adjust two settings:

# Comment out the bind line to make Redis listen on all interfaces
# bind 192.168.0.5

# Disable protected mode
protected-mode no
Enter fullscreen mode Exit fullscreen mode

Restart Redis after making the changes and connections should work again.

Note

This is fine for development environments. For production, keep protected-mode yes and use password authentication or firewall rules to control access instead.

Top comments (0)