1, the introduction of RedisRedis Open Source memory database, storing data in key-value way; Redis features: 1), Redis data is completely stored in memory, using disk only to persist data, solve the problem of data loss caused by restarting the server, 2), compared with other Key-value number Redis has a richer data type, 3), and Redis can replicate data to any number of slave servers.
2, the advantages of Redis1), execution very fast: can perform about 110,000 sets per second, about 81,000 records; 2), Rich data types: Redis supports most data types that are familiar to developers: strings, lists, collections, ordered collections, hash data types, 3), Atomic operation: All Redis operations are atomic, 4), multifunction utility:
3. Redis installationRedis is installed in the form of source code compilation. In a Ubuntu14.04 environment, install Redis. Redis version: redis-3.0.7.tar.gz
1), decompression redis-3.0.7.tar.gz:
TAR-XZVF redis-3.0.7.tar.gz
2), install the relevant environment (G++,make), if the server has been installed, then this step can be skipped:If g++ is not installed, you need to install it first:
If make is not installed, you need to install it first:
sudo apt-get install make
3), switch to the redis-3.0.7 directory, compile the program, install the program (if you want to install make on the server):
Make
"If you encounter errors" make[1]: Entering directory '/home/cb/environment/redis-3.0.7/src ' CC adlist.o ..... Then execute the following command to compile:
Make MALLOC=LIBC
Successful compilation of renderings:
4), into the SRC directory, the interpretation of relevant documents:
5), create Redis run directory: Mkdir/home/cb/toolsoftware/redis;
6), the file: redis-cli, Redis-server Copy to the Redis running directory;
CP Redis-cli Redis-server/home/cb/toolsoftware/redis
7), switch to the redis-3.0.7 directory, and copy the redis.conf to the Redis running directory;
CP Redis.conf/home/cb/toolsoftware/redis
8), front-end start Redis Service successful effect (CTRL + C will shut down the service):./redis-server
After the service is successfully started, a process is run:
After CTRL + C, the Redis-server service also closed.
9), the back end of the Redis service start:Modify the configuration file Redis.config: The daemonize no--> daemonize Yes #默认服务为前端启动, set to Yes, the service starts at the back end, and the backend starts the Redis service command:
./redis-server redis.conf #要把配置文件传入;
After the backend successfully starts the Redis service, a redis-server service process is started.
10), enter the Redis command terminal:
./redis-cli