Prior to a period of time due to business needs to study the next Redis-related information, redex from single-machine to cluster configuration of the various configurations in the personal blog update, so that the need for friends.
1 Overview
Redis is an open source, Key-value database, written in C, that supports network interaction and can be memory-based and persistent. Redis pioneered a new approach to data storage, and using Redis, we don't have to focus on the problem of how to put an elephant into a refrigerator in the face of a monotonous database, but instead use Redis's flexible data structure and data manipulation to build different refrigerators for different elephants.
Today most NoSQL databases are essentially key-value pairs, and Redis is no exception. As a cache database, compared with memcached, there are several main advantages:
(1) speed, Redis is faster than memcached, this is based on some benchmarks test results, and in memory use, Redis broke through the physical memory limit, can use virtual memory;
(2) More data types than memcached, Redis supports list, Set, SortedSet, HashMap and other data structures;
(3) Persistence, memcached does not have a corresponding persistence mechanism, and Redis has an RDB snapshot and aof log two forms of the combination of persistence, to a large extent to ensure the persistence of data and security, not like memcached after the power outage.
Redis is a good alternative to memcached.
1. References
1. Ultra-high Performance Key-value database Redis. Open source Community Network [citation date 2012-09-8].
2. Super, hyper-detailed Redis database Getting Started tutorial. Tibetan Treasure Court. 2014-12-06 [citation date 2014-12-23].
3. Redis2.4.16 Small update version of NoSQL. Open source Community Network [citation date 2012-09-25].
4. Redis2.4.17 Small update version of NoSQL. Open source Community Network [citation date 2012-09-25].
5. Redis 2.6.3 Released, high performance k/v server. China Linux Federation [citation date 2012-12-2].
6. Redis2.6.13 released, high performance k/v server. Linux Commune [citation Date 2013-06-19].
7. Redis2.8 Release Notes. git hub [citation date 2013-11-26].
8. Redis3.0.0 RC3 Released, high performance k/v database. Redis 3.0.0 RC3 released [citation date 2015-02-11]
< /c12>2 Custom installation
2.1 Download Address
Download website:
Http://www.redis.io/download
Chinese Web download:
Http://www.redis.cn/download.html
Guthub Download:
Https://github.com/ServiceStack/redis-windows
https://github.com/MSOpenTech/redis/tree/2.8
2.2 Installation Steps
The installation steps are as follows:
(1) Copy the redis-3.0.1.tar.gz installation package to our designated directory;
(2) Use the command TAR-ZXVF redis-3.0.1.tar.gz to extract the tar package, get the redis-3.0.1 directory;
(3) Enter the redis-3.0.1 directory, execute the make command to compile (you can also specify the appropriate compiled installation directory such as:
$ make Prefix=/usr/local/redis Install #安装到指定目录中
(4) After the compilation, configure the redis.conf file, set the "Daemonize" property to "yes", indicating that we will start the Redis service as a background process, set the "Port" property to the specified port, where the default is "6379"; "LogFile" property is set to the specified log path, and the remaining properties can remain the default.
(5) using the command src/redis-server./redis.conf starts the Redis service, and after startup, you can see similar information in the log path that you just configured:
The following action script:
Installation
Download, extract and compile Redis with:
$cd/usr/software
$mkdir redis
$cd redis
$ wget http://download.redis.io/releases/redis-3.0.1.tar.gz
$ tar xzf redis-3.0.1.tar.gz
$ cd redis-3.0.1
$ view Current operating system
$ if it is 32 bit: Make cflags= "-march=i686"
$ if it is 64 bit: Make $ make the binaries that is now
compiled a Re available in the srcdirectory. Run Redis with:
Note that the above run script, if make fails, is generally not installed in the system GCC, then can be installed through Yum:
$ yum Install gcc
Redis has been installed to completion.
When make succeeds, some binaries are generated under the SRC folder, including Redis-server, REDIS-CLI, and so on:
Description :
$ find. -type f–executable
./redis-benchmark//tools for Redis performance testing
./redis-check-dump//used to fix problems with Dump.rdb files
. REDIS-CLI//redis client
./redis-server//redis server
./redis-check-aof//used to fix problems with aof files
. Redis-sentinel//For cluster management
2.3 Complete the test
Modify the redis.conf configuration file under the installation directory;
Modify the Daemonize key parameter to set to Yes (set to run in the future daemon mode)
Open:
$./src/redis-server ./redis.conf
Redis uses 6379 as a service port by default
Close
$./src/redis-cli shutdown
Simple test:
$./src/redis-cli
redis> set name bar
OK
redis> get Name
"Bar"