First, Redis Introduction
Redis is one of the most popular NoSQL systems, and it is a key-value storage system. Similar to memcache, but largely compensates for the lack of memcache, which supports a relatively large number of stored value types, including string, list, set, Zset, and hash. These data types support Push/pop, Add/remove, and intersection-set and difference sets and richer operations. On this basis, Redis supports a variety of different ways of ordering.
Like Memcache, Redis data is cached in computer memory, except that memcache can only cache data in memory and not automatically write to the hard disk on a regular basis, which means that a power outage or reboot, memory emptying, data loss. So Memcache's scenario applies to caching data that does not need to be persisted. The Redis is that it periodically writes the updated data to the disk or writes the modification operation to the appended record file to achieve the persistence of the data.
Second, the installation of Redis
The following describes the installation and deployment of Redis in a Linux environment
1, First officer net Download Redis compression package, address: Http://redis.io/download Download stable version 3.0.7 can.
2, through the Remote management tool, the compressed package is copied to the Linux server, performing decompression operations
3. Execute make to compile the files after Redis decompression
After compiling, you can see the uncompressed file redis-3.0.7 will have the corresponding SRC, conf and other folders, this and Windows installation of the extracted files, the majority of the installation package will have the corresponding class files, configuration files and some command files.
4, after the successful compilation, into the SRC folder, execute make install for Redis installation
5, the installation is complete, the interface is as follows
Iii. Deployment of Redis
After the installation is successful, Redis is deployed below
1. First, in order to facilitate management, the Redis file in the Conf configuration file and common commands to the unified file
A) Create bin and redis.conf files
Copy Code code as follows:
Mkdir-p/usr/local/redis/bin
Mkdir-p/usr/local/redis/ect
B Execute Linux file Move command:
Copy Code code as follows:
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 Redis-server command, start Redis service
Note: The Redis-server-initiated Redis service is run directly in the foreground (the effect is shown above), that is, after the command is executed, if LUnix closes the current session, the Redis service closes. Normally, the start of the Redis service needs to start from the background and specify the startup configuration file.
3, background start Redis service
A) First edit the Conf file and change the Daemonize property to Yes (indicating that you want to run in the background)
CD etc/
Vi redis.conf
b Start the Redis service again and specify start service profile
Redis-server/usr/local/redis/etc/redis.conf
4, after the successful launch of the server, the implementation redis-cli start Redis client, view the port number.
Summary of Linux, Redis operations commonly used commands
Linux:
Cd/usr into parent folder from subfolders usr
CD local from parent to child
mv/a/b Move file A to B
VI usr/local/redis/redis.conf Edit redis.conf file
: Wq save changes, and exit
Redis:
Redis-server/usr..../redis.conf starts the Redis service and specifies the configuration file
Redis-cli start Redis client
Pkill redis-server turn off Redis service
REDIS-CLI shutdown close Redis client
Netstat-tunpl|grep 6379 View redis default port number 6379 occupancy