Redis is an open source, high-performance key - value storage (key-value store). It is often referred to as the server is a data structure (data structure server). Redis key-value can include strings (strings), hashes (hashes), lists (lists), set (sets) and ordered set (sorted sets) and other data types. For these data types, you can perform atomic operations. For example: the string additional operations (append); incrementing the hash value; add elements to the list; computing the intersection of the collection, and set the difference between sets.
In order to achieve superior performance, Redis used memory (in-memory) data set (dataset) manner. Depending on the usage scenario, you may from time to time to dump the disk data set up persistent data, or append the tail of the log every command.
Redis also supports master-slave replication (master-slave replication), and has a very fast first non-blocking synchronization (non-blocking first synchronization), network disconnect automatically reconnect function. Meanwhile Redis also has some other features, including a simple check-and-set mechanism, pub / sub and configuration settings to make Redis can behave more like cache (cache).
Redis also provides a rich client, in order to support the most popular programming language at this stage. You can see a detailed list of supported Redis official documents: http: //redis.io / clients. Redis itself written in ANSI C and can not generate external dependency (external dependencies) in the case of run on most POSIX systems such as: Linux, * BSD, OS X, and Solaris.
Description: Install 2.2.6 version of Redis selection, installation package for redis-2.2.6.tar.gz, system platform for CentOS 5.5.
1. Unzip the installation package
Use tar -xzvf redis-2.2.6.tar.gz to unpack the installation package. Assume that the Redis unzip directory for redis-2.2.6, using $ REDIS_HOME absolute path to represent. Its directory structure is as follows:
Wherein, README and INSTALL contains compiled, simple installation instructions Redis, before he started, please read these two documents.
Enter $ REDIS_HOME / src directory, use the make command to compile Redis, the compilation process will produce redis-server binaries.
After compiling Redis is completed, it is best to use make test command to conduct some tests, but this step is not necessary.
Redis use make install to complete the installation. Redis all the binary files will be installed in / usr / local / bin directory.
Redis running and testing:
Suppose Redis installed in / usr / local / bin directory, and the directory is included in the $ PATH environment variable search directory. Then you can use redis-server to run Redis. If Redis is installed in a different directory, you can use the / path / to / redis-server to start the Redis, or Redis installation directory is added to $ PATH search directories.
Redis comes with a program called redis-cli command-line client, the client will automatically compiled at runtime make command. Users can use the client to complete Redis some simple tests or operations.
Use redis-cli to start the client, start a command line prefix: redis>. Users can operate in this follow-up, similar to the MySQL command line mode.
For example, use the following command to store key-value pairs:
Use get command to get the value stored:
At this point, Redis installation and simple test is complete. Note that, when running make test command, sometimes there are mistakes:
(Cd ..; tclsh8.5 tests / test_helper.tcl --tags "" --file "")
/ Bin / sh: tclsh8.5: command not found
make: *** [test] Error 127
The reason for this error is because when you run make test command, Tcl 8.5 library, and CentOS 5.5 comes with version 8.4. Users can use the following command to view:
At this point, you can go to the official website http://www.tcl.tk/ Tcl version 8.5 to download, and follow the installation instructions to install Tcl can own. After the installation is complete, use ldconfig again Views:
At this point, you can run make test command again.
1, from the official website to download and extract the source code
tar xzf redis-2.2.5.tar.gz
2, compiled, and accelerate the use of tcmalloc
make USE_TCMALLOC = yes
3, start redis
4. Verify use tcmalloc
lsof -n | grep tcmalloc
redis-ser 26689 root mem REG 253,3 1800221 4182039 /usr/local/lib/libtcmalloc.so.0.1.0
redis-ser 26694 root mem REG 253,3 1800221 4182039 /usr/local/lib/libtcmalloc.so.0.1.0
redis-ser 26697 root mem REG 253,3 1800221 4182039 /usr/local/lib/libtcmalloc.so.0.1.0
redis-ser 26701 root mem REG 253,3 1800221 4182039 /usr/local/lib/libtcmalloc.so.0.1.0