Install redis in windows environment, configure password, configure remote link

Github  download address: Tags microsoftarchive/redis GitHub

Download the msi installation file when downloading:

1. First double-click the now finished installer

2. Click next

3. Click to accept and continue to next

4. Set the service port of Redis, the default is  6379 , the default is fine, click next

5. Select the installation path and check it (this is very important). Adding to the path is to set Redis as a service under windows, otherwise you have to start the command redis-server redis.windows.conf in this directory every time, But as soon as the cmd window is closed, redis will disappear, which is more troublesome.

6. Set Max Memory, then next to enter the installation

If the application scenario of redis is used as a database, then do not set this option, because the database cannot tolerate data loss.

If it is used as a temporary cache, it depends on your own needs (I set a maximum memory limit of 1024M here)

Specify the maximum memory limit of Redis. Redis will load data into the memory when it starts. After reaching the maximum memory, Redis will first try to clear the keys that have expired or are about to expire. After this method is processed, the maximum memory setting is still reached. Write operations will no longer be possible, but read operations will still be possible. The new vm mechanism of Redis will store the Key in memory and the Value in the swap area.

7. The installation is complete

8. Test the installed Redis

If you installed through the msi file like me, you can see that Redis is running in " Computer Management→Services and Applications→Services "

Run redis-server in cmd

Run successfully Install successfully

Error resolution:

 Creating Server TCP listening socket *:6379: bind: No such file or directory

If the following error occurs

Enter the following commands in order as follows to connect successfully

  1. redis-cli.exe
  2. shutdown
  3. exit
  4. redis-server

 

Test 2:

Start redis-cli.exe under the installed redis and enter ping to see if it returns PONG

 Finally, let us feel the charm of redis!

Open a new cmd input redis-benchmark -q -n 10000

(Redis performance test: In the above example, the host is 127.0.0.1, the port number is 6379, and the number of requests is 10000. The -q parameter allows the result to only display the number of requests executed per second.)

8. Configure password

First find two configuration files in the redis installation directory. For the sake of safety, make a backup first. In case of subsequent problems, you can trace the source and file back.

 Notepad opens the configuration file ctrl+f to find requirepass

Remove the comment # and add the password  

requirepass 123456

 restarted the service

Enter redis, auth password

Then ping again to get the pong password project configuration successfully 

 

remote link:

1. Comment out the local IP address

#bind 127.0.0.1

2. Turn off the protected mode (change yes to no) 

protected -mode no

Guess you like

Origin blog.csdn.net/weixin_45987577/article/details/124798663