Saturday, May 17, 2014

Run Redis on Windows using Vagrant

How do I run Redis on Windows for my Development?


After reading through couple of articles and threads on stackoverflow I figured out the easiest way is to use install Redis on Vagrant and use port forwarding to connect to Redis from Windows.

Here the steps required
  1. Download and Install Vagrant.
  2. Install Redis on Vagrant
    1. Add necessary repos to Ubuntu

      echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
    2. Install Redis

      apt-get update
      apt-get -y install redis-server
  3. Configure Redis

    Verify redis installation



    in order to connect from windows
    $ vi /etc/redis/redis.conf

    Comment "bind 127.0.0.1"
  4. Enable Port Forwarding in Vagrant
    Add the port forwarding configuration to the Vagrant file under the Vagrant\bin folder in windows.

    config.vm.network "forwarded_port", guest: 6379, host: 6379 # redis port forwading
  5. Enable firewall ports in windows

    Add rules to the windows firewall to enable port 6379 for Redis

    netsh advfirewall firewall add rule name="Redis Port 6379" dir=in action=allow protocol=TCP localport=6379
    netsh advfirewall firewall add rule name="Redis Port 6379" dir=out action=allow protocol=TCP localport=6379
  6. Connect to Redis using the Redis Desktop Manager