Redis installation tutorial in window environment
download
Enter this URL to download the window versionhttps://github.com/microsoftarchive/redis/releases
after installation
Open the cmd window redis-server --version
and enter to view the version of redis.
Enter where redis-server
to find the installation location of redis.
File structure
In the redis installation directory, open the cmd window and enter redis-server.exe redis.windows.conf
to open it, but sometimes the port number is occupied.
This problem can be solved by doing the following
If you find that port 6379 used by Redis is occupied by other applications, you can try the following steps to solve the problem:
-
Find the process occupying the port:
-
Open a command prompt and run the following command:
netstat -ano | findstr "6379"
-
The system displays information about the process that is using the port, including the process ID (PID).
-
-
Terminate the process occupying the port:
-
At the command prompt, type the following command to kill the specified process (replace <process_id> with the actual process ID):
taskkill /PID <process_id> /F
For example,
taskkill /PID 12345 /F
-
This will forcibly close the process that is using the port, make sure that the process is not causing any significant impact on your system.
-
-
Change the listening port of the Redis configuration file:
- Open the Redis configuration file (redis.conf or redis.windows.conf).
- Modify
port
the value of the parameter to an unoccupied port number. For example, it can be modified to 6380. - Save the configuration file.
-
Restart Redis:
-
In the command prompt, navigate to the Redis installation directory.
-
Start the Redis server:
redis-server.exe redis.windows.conf
-
Make sure Redis is running properly on the new port.
-
These steps should help you resolve Redis port occupied issues. If the problem persists, make sure that no other process is using the specified port, or make sure to restart the Redis server after changing the configuration file.
run successfully
The way to enter redis is to enter it in the cmd window redis-cli.exe -h 127.0.0.1 -p 6379
. The premise is that the redis service needs to be run first.
Then enter ping to see if there is any response, then you can
exit and enter exti
When you use the command on the command line redis-cli.exe
, it starts the Redis command line client and provides you with an interface to interact with the Redis server. The following is an explanation of the commands and parameters:
redis-cli.exe
: This is the executable for the Redis command line client. Running this command will start the Redis client.
Commands can be followed by a number of optional parameters to configure the behavior of the client. The following are some commonly used parameters:
-
-h <hostname>
Or--host <hostname>
: This parameter is used to specify the hostname or IP address of the Redis server to connect to. You can use this parameter to connect to a remote Redis server. If this parameter is not specified, the default connection is to the local host. -
-p <port>
Or--port <port>
: This parameter is used to specify the port number of the Redis server. By default, Redis uses port 6379. If your Redis server uses a non-default port, you need to use this parameter to specify the correct port number. -
-a <password>
Or--passwod <password>
: This parameter is used to specify the authentication password of the Redis server. If your Redis server has a password set, then you need to use this parameter to provide the correct password in order to connect.
These are just redis-cli
some of the common parameters that may be used, there are other advanced options and features that can be explored. You can redis-cli.exe --help
get detailed help about the Redis command-line client by running , which includes all available parameters and usage examples.
Using redis-cli.exe
the client, you can interact with the Redis server and perform various commands and operations, such as setting key-value pairs, executing queries, subscribing to publications, and more. In the client, you can enter commands to communicate with Redis, and get results and process data based on Redis responses.
set password
Enter the redis.windows.conf directory
search requirepass
Then uncomment, and then you can set the password to 123456
and then start the service again, enter and redis-cli.exe -h 127.0.0.1 -p 6379
then enter and root@123456
it will be successful
visualization tool