Redis - Dealing with (error) NOAUTH Authentication required
Overview
A Redis instance that had been running for years without any memory issues
suddenly started throwing connection errors, so I’ve summarized how I handled it.
The Error
1 | PHP Fatal error: Uncaught exception 'RedisException' with message 'Failed to AUTH connection' |
The authenticated connection failed and an Exception was thrown.
I hadn’t set requirepass anywhere in the Redis configuration,
so it felt like “why all of a sudden?”.
The path to the Redis config differs across environments, but in my case it was as follows:
/etc/redis/6379.conf
As shown below, requirepass is commented out.
1 | # requirepass |
The Fix
- Kill the process
- Note: restarting Redis with something like
service redis restartdid not change the situation.
1 | # ps aux | grep 'redis' | grep -v 'grep' |
- Start Redis again.
1 | # service redis start |
- Set requirepass
Since the system was in operation and I didn’t want to touch the application’s source code itself,
I set an empty requirepass.
1 | redis-cli> CONFIG SET REQUIREPASS '' |
The above was enough to handle the immediate situation without problems.
Wrap-up
When using Redis again, it would be better to configure authentication
and have the application connect with a password specified as well.
That said, I’ll continue investigating why this suddenly happened.
If anyone knows the reason, I’d be grateful for a comment.
Redis - Dealing with (error) NOAUTH Authentication required
https://kenzo0107.github.io/en/2015/12/12/redis-error-noauth-authentication-required/