Simple use of Redis and introduction to the Linux (CentOS 5.4) Redis Install

Source: Internet
Author: User

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

    1. wget http://redis.googlecode.com/files/redis-2.0.4.tar.gz

    2. Tar zxvf redis-2.0. 4. tar.gz

    3. CD redis-2.0. 4

    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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.