You’re unique, nothing can replace you
You are unique in the world, no one can replace
Record the installation of redis and use related notes to prevent forgetting. I personally think that redis compared with rabbitmq and mysql, it is relatively simple, of course, this is related to the use of redis, I also use the primary. In the future, I will record the problems related to redis in this article. This time, I will record the most basic installation process and use it.
Note: After the compilation is completed, the compiled redis service program redis-server and redis-cli will appear in the directory. Under the installation directory src, the system environment variables can be set.
The way to specify the configuration file starts:
Description: redis.conf is a default configuration file, we can use our own configuration file as needed.
By default, redis listens on port 6379 and can be modified through the configuration file.
After the redis is installed by default, the server and client link tools will be installed, namely redis-cli.
Local connection will link to the local redis service by default.
The remote connection will connect to the redis service on the remote server. If there is no password, you do not need to write the -a parameter.
Test if a password is set
Note: The above output indicates that no password is set. Redis does not set a password by default.
Test if the server is running:
Note: Returning to PONG indicates that the operation is normal.
Create a key:
Get the value of the key:
Description: The above three are the most commonly used commands (for string types, other types of please look down), of course, there are many advanced syntax.
Get all the keys:
Check if the given key exists:
Simply put, the data structure is the format of redis storage data, different data structures, and the commands used for operation are different.
The Redis configuration file is located in the Redis installation directory and the file name is redis.conf. Modify the configuration by modifying the redis.conf file or modifying the configuration by using the command line.
Basic command format:
Get all configuration items:
Set the log level:
The redis.conf configuration item is described as follows:
Python has a third-party module dedicated to redis, project address: https://github.com/WoLpH/redis-py
Or github download source installation:
For more python+redis usage, please go to: http://python.jobbole.com/87305/
Clear all data:
Note: Therefore, the redis password cannot be empty. Redis defaults to no password. As for setting the password, please look for it from above.