Redis is a high-performance Key-value database. The emergence of Redis, to a large extent, compensates for the lack of memcached such keyvalue storage, in some cases can be a good complement to the relational database. It provides the Python,ruby,erlang,php,java client, which is very convenient to use.
Redis uses a single-threaded IO multiplexing model, which encapsulates a simple Aeevent event processing framework that implements Epoll, Kqueue, and select, which can be used to maximize the speed advantage for purely IO operations. However, Redis also provides some simple computing functions, such as sorting, aggregation, etc., for these operations, the single-threaded model can actually seriously affect the overall throughput, CPU calculation process, the entire IO schedule is blocked.
In addition to being stored as storage, Redis also provides some other functions, such as aggregation calculation, pubsub, scripting, etc., for such functions need to understand its implementation principle, clearly understand its limitations, can be used correctly, such as pubsub function, This is actually not supported by any persistence, the consumer connection between the flash or the reconnection between the message is all lost, and such as aggregation calculation and scripting and other features are limited by the Redis single-threaded model, it is impossible to achieve high throughput, need to use caution.
This example Linux uses the CentOS5.4
Here's an introduction to Redis installation
wget http://redis.googlecode.com/files/redis-2.0.4.tar.gz
Tar zxvf redis-2.0. 4. tar.gz
CD redis-2.0. 4
Make
After make the redis-2.0.4 directory will appear after the compiled Redis service program Redis-server, as well as the client program for testing REDIS-CLI
Installation Successful
Start the service
./redis-server
You can also tell Redis to start using the specified configuration file using the following command via the startup parameters
./redis-server redis.conf
Redis.conf is a default configuration file. We can use our own configuration files as needed.
Once the Redis service process is started, you can use the test client program REDIS-CLI to interact with the Redis service
Note that when you start, it appears
WARNING Overcommit_memory is set to 0! Background save may fail under
Low memory condition. To fix this issue add ' vm.overcommit_memory = 1 ' to/etc/sysctl.conf and
[6020] 20:58:21 * The server is nowready to accept connections on port 6379
[6020] 20:58:21-0 clientsconnected (0 slaves), 533432 bytes in use
[6020] 20:58:30-0 clientsconnected (0 slaves), 533432 bytes in use
Because the default configuration is to connect to the native
At this time you need to modify the IP address of the configuration file to connect your server.
And there is the execution: Sysctl Vm.overcommit_memory=1
And then you start the service.
Simple use of Redis and introduction to the Linux (CentOS 5.4) Redis Install