First, Redis Introduction
Redis is one of the most popular NoSQL systems at the moment, it is a key-value storage system. similar to Memcache, but largely compensates for the lack of Memcache , which supports storing more value types, including string, list, set, Zset and Hash. These data types support Push/pop, Add/remove, and intersection sets and differences, and richer operations. Based on this,Redis supports sorting in a variety of different ways.
as with Memcache, Redis The data is cached in the computer's memory, the difference is that memcache can only cache data into memory and not automatically write to the hard disk periodically, which means that a power outage or reboot, memory emptying, and data loss. So Memcache's application scenario is for caching data that does not need to be persisted. The difference between redis is that it periodically writes the updated data to the disk or writes the modified operation to the appended record file , which makes the data persistent .
second, the installation of Redis
The following is a description of the Linux environment installation and deployment of Redis
1. First Officer Network Download Redis compressed package, Address: Http://redis.io/download Download the stable version of 3.0.7.
2. Use the Remote management tool to copy the compressed package to a Linux server and perform the decompression operation
3. perform make to compile files after Redis decompression
After compiling, you can see that the extracted file redis-3.0.7 will have the corresponding SRC, conf and other folders, which is the same as installing the extracted files under Windows, most of the installation packages will have corresponding class files, configuration files and some command files.
4. once the compilation is successful, go to the SRC folder and perform the make install for Redis installation
5. installation complete, the interface is as follows
iii. deployment of Redis
After the installation is successful, Redis is deployed below
1. first, to facilitate management, move the Conf configuration file and common commands in the Redis file to a unified file
A) Creating Bin and redis.conf files
Mkdir-p/usr/local/redis/bin
Mkdir-p/usr/local/redis/ect
b) To execute the Linux file Move command:
Mv/lamp/redis-3.0.7/redis.conf/usr/local/redis/etc
Cd/lamp/redis-3.0.7/src
MV mkreleasdhdr.sh Redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server/usr/local/redis/bin
2. execute the redis-server command to start the Redis service
Note: The Redis service, which executes the redis-server boot directly, is run directly in the foreground (as an effect), that is, if LUnix closes the current session after executing the command, the Redis service is closed. Under normal circumstances, starting the Redis service requires booting from the background and specifying a startup configuration file.
3. Back up Redis service
a) first edit the Conf file, change the Daemonize property to Yes (indicating that you need to run in the background)
CD etc/
V I redis.conf
b) start the Redis service again, and specify the Startup service configuration file
Redis-server/usr/local/redis/etc/redis.conf
4. after the server starts successfully, execute REDIS-CLI to start the Redis client and view the port number.
Iv. Summary of common commands for Linux and Redis operations
Linux:
Cd/usr from subfolders into parent folder usr
CD local from parent to child
mv/a/b Moves file A to B
VI usr/local/redis/redis.conf Edit redis.conf file
: Wq Save the changes and exit
Redis:
redis-server/usr..../redis.conf start the Redis service and specify the configuration file
REDIS-CLI starting the Redis client
Pkill redis-server off Redis service
REDIS-CLI Shutdown Close Redis Client
Netstat-tunpl|grep 6379 View Redis default port number 6379 occupancy
Installation and deployment of Redis (Linux)