1, the introduction of RedisRedis Open Source memory database, storing data in key-value manner; Redis Features: 1), Redis data is completely stored in memory, the use of disk is only to persist data, to solve the problem of restarting the server caused by data loss, 2), Redis has a richer data type than other Key-value databases, 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 an error is encountered" 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
Compiled successfully:
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:daemonize no-->daemonize Yes #默认服务为前端启动, set to Yes, the service starts at the back end;The back end 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
Redis Introduction and compilation Installation--standalone