Redis is very different in Linux and installed under Windows, and the usual software installation is the same.
Download Redis installation package
To Redis website Download Reids installation package, Redis official website defaults to provide only Linux installation package, so do not worry about downloading to Windows installation package. The author downloads is redis-3.2.1.tar.gz. Download for the Redis source code, you should use the source installation method to install Redis.
Second installation Redis
1. Decompression: TAR-ZXVF redis-3.2.1.tar.gz
2. Enter the extracted directory and perform the compile operation: Make Test
3. After compiling the test, the following information appears, proving that there is no problem: The compiled command is placed in the SRC directory
4. After successful compilation, perform the install operation: sudo make install
5. At present Redis has been installed successfully redis related commands are stored in the. /REDIS-3.2.1/SRC directory, the following files are generated in the/usr/local/bin/directory:
two unloading of Redis
1. See if the Reids is running, and if it's running, close it first.
As you can see from the diagram, Redis-server is currently running on port 6379
2. If the Redis-server service is running in the background, you need to stop the Redis-server service:
Normal stop Redis-server service, use reids Client command: REDIS-CLI shutdown
If it can't stop, then take the way to kill the process: kill-9 PID
3. Delete the Redis-related commands in the/usr/local/lib directory:
4. Delete Redis after decompression of the directory redis-3.2.1 can
The launch of the three Redis
After the Redis installation is successful, the corresponding Reids command file is generated, all commands are in the SRC directory, and several commands are generated in the/usr/local/bin directory, so that we can not use the absolute path when invoking the Redis related commands. There are many ways to start Reids, background startup, script startup, and so on.
1. Redis background start: Redis-server &
This method does not specify a profile, uses the default configuration, and prints a warning:no config file ....
Press CTRL + C to exit the Redis startup window, at which point Redis will not close, but will run in the background, can be viewed by command: PS aux | grep Redis
2. Specify configuration file Startup: Redis-server ***/redis.conf
After extracting the original text of Redis, there is a Redis configuration template redis.conf in the directory, we can copy it and modify it to our own Redis configuration file. Here the author modifies only one port number, modifies the port number to 8080, and then starts the Redis service using this profile
Turn off use command: redis-cli-p 8080 shutdown
3. Set boot up:
four Redis customer segment connection:
After the Redis installation succeeds, a REDIS-CLI client is generated that can connect to the local or remote Redis server through the REDIS-CLI command. REDIS-CLI command has many parameters, commonly used options are-h-p-u-a, corresponding to the IP address, port number, user name, password, can be redis-cli--help to view the common options redis-cli
1. Connect Local Redis Example:
2. Connect Remote Redis:
Five close Redis
1. Normal shutdown local REDIS:REDIS-CLI shutdown, default shutdown local 6379 Redis
If the normal shutdown is not possible, it can be closed by killing the thread:
2. Remote shutdown Redis server: redis-cli-h xxx.xxx.xxx.xxx-p xxxx-u xxxx-a xxxx shutdown