Introduction to Redis
Redis is an open source, advanced key-value store and a suitable solution for building high-performance, scalable web applications.
Redis has three main features that make it superior to other key-value data storage systems-
- Redis keeps its database completely in memory and uses only disk for persistence.
- Compared with other key-value data storage, Redis has a relatively rich set of data types.
- Redis can copy data to any number of slaves.
Redis installation
Redis is developed based on C language, so you need to install C language environment
Enter the command in linux: yum install gcc-c ++
If prompted to download, enter y
Sign of successful installation
Put the downloaded redis compressed package (.tar.gz file) into the linux system, I put it in the / usr / local / software directory
Go to the directory where the compressed package is located and unzip the file to the / opt / modules directory. The difference between opt and usr is the location of opt to store large service software, so install redis to this directory
tar -zxvf redis-3.2. 5 .tar.gz -C / opt / modules
After the secret conversion is successful, a bin directory will appear in the installation directory
Enter the bin directory
Start redis-server
Sign of successful startup
Set up backend startup
Directly execute redis-server and start the front end. Once the client window is closed, this service will close the client, and no other commands can be executed in the client window
So you need to set up the back-end startup, start redis-server through the configuration file
File: The location is where the installation package was unzipped: redis.config
Set redis.conf configuration
The default is 127.0.0.0 modified to its own hostname name or ip name
Execute sql statement
Basic commands in redis:
General instructions:
Get all keys according to the expression key * (expression)
Determine whether there are exist keys for multiple keys ***
View key type type key
About redis database commands
select index select database (database switching)
The number of keys in the dbsize database
flushdb clears all keys in the database
flushAll clears all keys in the database
Kill process
./reids-cli -h 192.168.59.160 shutdown
Five major data type commands
https://blog.csdn.net/zk673820543/article/details/60569944