25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Could not connect to redis connection refused – Fix it easily

by | Jun 12, 2020

Learn how to fix the “Could not connect to Redis connection refused “ error with ease. Our Server Management Support team is here to help you with your questions and concerns.

Could not connect to Redis connection refused – Fix it easily

Could not connect to redis connection refused

Most webmasters and web hosts that use Redis would have seen this error:

Could not connect to Redis at 127.0.0.1:6379: Connection refused

It is usually caused when the Redis service is stopped in the server.

As part of our Server Management Services for online service providers and website owners, we have seen several other causes for this error.

Today we’ll go through the top causes and fixes for the Redis connection refused error.

 

What causes the Redis connection refused error?

Redis is used by many to reduce application load time. However, users at times complain that they receive a connection refused error after installing the Redis extension.

The common reasons that trigger the error include:

  • Redis-Server not Started
  • Firewall Restriction
  • Resource usage

Apart from these, there are some alternate reasons that trigger the Redis connection error. Today, let’s look into the reasons behind this error and its fixes.

 

Redis-Server is not started

The most common reason for the connection refused error is that the Redis-Server is not started.

Redis server should be started to use the Redis client after its installation. It can be done with the following command.

redis-server

Also to run Redis in the background, the following command could be used.

redis-server --daemonize yes

Then, we can verify that our Redis server is running with this command:

redis-cli ping

If we get a PONG response back, it indicates the issue is resolved.

However, if we get a permission error when running the redis-server command, we have to rerun the command with sudo.

sudo redis-server
or
sudo redis-server --daemonize yes

Firewall restriction

Firewall restriction is another common reason that can trigger the “could not connect to Redis connection refused”.

By default, the Redis server listens to the TCP port 6379. If another application is using the port or if the firewall restrictions blocks the port, it can trigger the connection refused error.

Thus, it is important to check the status of the port in the firewall configuration while troubleshooting the could not connect to Redis error.

 

Resource usage 

As we discussed earlier, Redis uses the main memory to store the data. Thus if the resource in the server is not sufficient for the process to run, it may get terminated abruptly.

When the status of the Redis process is down, it triggers the could not connect to Redis error. We could confirm if it is running with the ps command.

ps -aux | grep redis

 

Our Support Engineers analyze the Redis log file to confirm if the service is repeatedly flapping in the server. From a simultaneous analysis of other log files, we confirm if any other process is consuming resources in the server and is causing Redis to terminate.

 

Alternate reasons

Apart from the reasons mentioned above some settings in the Redis configuration file could also result in the connection failed error. The default location for the configuration file in Ubuntu 18 is  /etc/redis/redis.conf.

Some of the reasons that may trigger the connection refused error include:

  • The password is set in the Redis configuration file. To fix it, comment the following line.
    #requirepass

  • If the IP binding is not open for access from the internet in the config. Commenting the following lines will fix the issue.
    # bind 127.0.0.1 ::1

  • Verify that the correct Redis port settings are configured. The default port is usually 6379.
  • If the issue recurs, we can try changing the port number in the Redis configuration file to a different value and then restart Redis.
[Are you struggling with Redis errors? We’ll fix it right away.]

Conclusion

In short, a number of reasons can trigger the “Could not connect to Redis connection refused” error. This ranges from firewall restrictions to resource limitations. Today we discussed how our Support Engineers fix the error in each scenario.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

5 Comments

  1. Saumya Bhattacharya

    I am getting this issue intermittently when my redis is running on a gcp VM (debian 10)?

    Reply
    • Hiba Razak

      Hi Saumya,
      Please contact our support team via live chat

      Reply
  2. Robert

    excellent info. Thanks. Got me going

    Reply
  3. khabarqus

    Getting java.net.ConnectException: Connection refused: no further information while connecting Redis with postgres using Spring Boot and redis dependency in pom.xml.

    kindly help.

    Thanks.

    Reply
    • Hiba Razak

      Hi,
      Please contact our support team through live chat (click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF