How to Install and Configure Redis on Windows

Read our post to get an overview of how to install and configure Redis on Windows

1.png

  1. Open a command window, and use the CD command to enter the directory where you keep the unzipped files.
  2. To start Redis, type: redis-server redis.windows.conf. After that, you can see the Redis port number is 6379. (This step shows you a temporary service. If you need to install Windows Services, please turn to the next step.)
  3. Add Redis as a Windows Service: First, close the previous Command Prompt window (or you cannot start the service), and then open another Command Prompt window. Type: redis-server--service-install redis.windows.conf

The default port of Redis is 6379. If you need to change it, please consult in redis.windows.conf file.

  1. After installation, Type: redis-server --service-start to start the service. (If you fail to start Redis Service, that is because you don’t actually close the previous Command Prompt window. The error below is also due to the same reason.)

Next, follow the path: Control Panel - Administrative Tools - Services, and find the Redis Service. Click to start, and see an error.

Some commonly used Redis commands:

To uninstall the Redis Service: redis-server --service-uninstall

To start the Redis Service: redis-server --service-start

To stop the Redis Service: redis-server --service-stop

  1. To test Redis, use the CD command to enter the directory where you keep the unzipped files. Type: redis-cli, and then using set and get command to check whether you succeed or not.

(1). E:

(2). cd E:\Personal Files\Redis-x64-3.2.100

(3). redis-cli

You don't need to restart Redis after changing password in a DOS window.

If you have to set your password, open a Command Prompt window, and use the CD command to enter into the directory where you installed Redis

redis-cli //To start the service

config get requirepass //To get a Redis password. If there is an error in this step, you need to auth the password first and then change the password.

config set requirepass 123456 //To set a Redis password

auth 123456 //To authenticate the password

If you have to edit Redis's configuration files conf,

requirepass

You need to restart Redis.

About jedis, jedispool and redisTemplate

You need to import the jedis package for jedis, and the common-pool package for jedispool. Additionally, Spring encapsulates a more powerful template, redisTemplate, to facilitate the operation of the Redis cache.