Redis Server on Bash on Windows

Written by ppolyzos

Software engineer based in beautiful Luxembourg


  1. Danilo Ribeiro

    Hi, Nice post.
    I’m getting this working just like you describe, but now I’m trying to connect on Redis with Nodejs and I’m getting connection refused error.
    I have node running on windows CMD and Redis running on Bash, is it possible to get both working together this way or I have to run Nodejs on Bash too?

    1. ppolyzos

      Currently you are not able to connect with redis-client to Bash from Windows using `localhost` as `localhost` is translated to `127.0.01`.

      I created a very simple app to test it out and got the same error:

      // app.js
      var redis = require('redis');
      var client = redis.createClient(6379, "localhost");
      client.on('connect', function() {
      client.set('framework', 'AngularJS');

      Error: Redis connection to failed – connect ECONNREFUSED
      at Object.exports._errnoException (util.js:1012:11)
      at exports._exceptionWithHostPort (util.js:1035:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1080:14)

      This is happening if you start redis server with

      $ redis-server

      If you start redis-server as a service you are able to connect without any issues.
      So start redis-server with the following command:

      $: sudo service redis-server start
      1. Leandro

        Hi 🙂

        I’ve started Redis with “sudo service redis-server start” and yet even in the same bash window I can’t connect to Redis.

        I’m running Windows 10 Home (1709, 16299.309), “uname -r => 4.4.0-43-Microsoft”, redis 3.2.11.

        I’ve tried to add TCP rule inbound/outbound to port 6379 on firewall but with no success though.

        Is ther anything else that I could do to get it working?

        Appreciate any help. Thanks a lot!

Leave a Comment

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