Simple use and introduction of Redis linux (centos 5.4) redis install

Source: Internet
Author: User

Redis is a high-performance key-value database. The emergence of redis largely compensates for the shortage of keyvalue storage such as memcached, and can play a very good complementary role in relational databases. It provides Python, Ruby, Erlang, PHP, and Java clients for ease of use.
Redis uses a single-thread IO multiplexing model and encapsulates a simple AeEvent event processing framework, which mainly implements epoll, kqueue, and select. For IO operations alone, A single thread can maximize the speed advantage, but Redis also provides some simple computing functions, such as sorting and aggregation. For these operations, the single-threaded model will seriously affect the overall throughput. During CPU computing, the entire IO scheduling is blocked.

In addition to storage, Redis also provides some other functions, such as aggregate computing, pubsub, and scripting. For such functions, you need to understand their implementation principles, you can use pubsub correctly only after you understand its limitations. For example, the pubsub function does not support persistence, all messages sent from the consumer's transient disconnection or reconnection will be lost. For example, functions such as aggregate computing and scripting are limited by the Redis single-thread model, it is impossible to achieve a high throughput, so use it with caution.

In this example, CentOS5.4 is used in Linux.

The following describes how to install apsaradb for redis.

  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 compiled redis service program redis-server will appear in the redis-2.0.4 directory, as well as the client program redis-cli for testing.

Installed successfully

Start the service

./Redis-server

You can also use the following command to tell redis to start it using the specified configuration file through the startup parameter:

./Redis-server redis. conf

Redis. conf is a default configuration file. We can use our own configuration files as needed.

After starting the redis service process, you can use the test client redis-cli to interact with the redis service.

Note that

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] 10 Aug 20:58:21 * The server is nowready to accept connections on port 6379

[6020] 10 Aug 20:58:21-0 clientsconnected (0 slaves), 533432 bytes in use

[6020] 10 Aug 20:58:30-0 clientsconnected (0 slaves), 533432 bytes in use

Because the default configuration is connected to the Local Machine

At this time, you need to modify the IP address of the configuration file to connect to your server.

Also, run sysctl vm. overcommit_memory = 1.

Then start the service.

  • 1
  • 2
  • Next Page

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.