Setting up Redis on a windows server and testing connectivity
In this post I will show you how to install redis on windows and test for connectivity.
Download the latest release at https://github.com/MSOpenTech/redis/releases
Perform the installation, leave everything as default. By default, redis should already configure your windows firewall to allow communication with the redis-server.exe file, redis server runs on port 6379 so make sure that port is opened on hardware firewalls, etc.
After the installation is complete, a window service called “Redis” is created, this is your redis server.
Browse to the installation path, on my setup this was C:\Program Files\Redis
Open the file redis.windows-service.conf NOT redis.windows.conf
We want to make a couple changes to secure the server with a password and set the ip address binding:
- Setting Password: Search for the word “requirepass”, this was on line 445 in my configuration file, uncomment and set a proper password, something strong.
- Setting IP Address binding: By default it seems the redis server is configured to only work locally, because of the one binding to the loopback interface address, you should see a line “bind 127.0.0.1”, make sure to comment this, by doing so your redis server will be bound to all ip addresses on the server.
After making these changes, restart your Redis service and check the log file server_log.txt for error, you should see something like:
“ 10 Sep 09:38:35.358 * The server is now ready to accept connections on port 6379”
Testing Remote Connectivity
After installing you may want to test your remote connectivity to the redis server.
Grab a copy of redis-cli.exe in the installation folder and place on another computer to test.
I then opened a command prompt and went to that folder where redis-cli.exe was placed and issued the command:
.\redis-cli.exe -h MYSERVER.COM -a MY_SECURE_PASSWORD
I hope this helps! If you have any questions feel free to contact me on twitter: @tekguy