Redis Service Rapid Deployment

Source: Internet
Author: User
Tags install redis

The official description of Redis:

Redis is a open source, BSD licensed, Advanced Key-value cache and store. It is often referred to as adata structure server since keys can contain strings, hashes, lists, sets, sorted set S, bitmaps andhyperloglogs.

Redis is an open source, BSD licensed, advanced " key-value " cache with storage . It is often referred to as a data structure server because keys can be strings, hash tables, lists, collections, ordered collections, bitmaps, and hyperloglogs.

Introduction to Redis outlines the key features and capabilities of Redis:

    1. Atomic Operations (All commands are atomic operations )
    2. in-memory DataSet (All data is put in memory )
    3. Keys with limited time to live
    4. LRU Cache
    5. Persistence of (rdb-memory Snapshot | Mirror, aof-append each command to the log)
    6. Master-Slave asynchronous replication
    7. sentinel- automatic failover
    8. Transaction
    9. Publish/Subscribe
    10. Lua script
    11. Recommended use of Linux System Deployment

and common command usage scenarios :

    1. Increase the value in a hash table (a counter or property of a different dimension)
    2. Presses an element into a list (message list, queue)
    3. Get the highest ranked members from an ordered set (top N, hotspot real-time news, hotspot search)

Reference

    1. Redis command Chinese version, huangz students ' translation

"Hands-on practice"

Practice Goal: Explore highly reliable and scalable distributed Redis cache scenarios

In the practice of the process has not understood the place, will go to see documentation have not I want the East ~

The steps to compile and install from the Redis source code are as follows:

1. Download the latest stable version from download and unzip it

Linux Code
    1. $ wget http://download.redis.io/releases/redis-2.8.17.tar.gz
    2. $ TAR-XZF redis-2.8.17.tar.gz

2. After extracting the files, be sure to carefully read the INSTALL and README (redis-2.8.17) under the release file (there are some important information waiting for you to understand, can save you a lot of time in the future Oh! You know ~ ^_^)

3. Follow the steps in the README to build Redis, run Redis, play Redis, install Redis

3.1 Building Redis (be sure to run tests on the server to make sure all commands are available)

Linux Code
    1. $ CD redis-2.8.17
    2. $ make
    3. $ make Test

When building, I encountered an error that prompted the "missing C + + compiler" and would prompt for an available installation package ("sudo apt-get install g++").

3.2 Running a Redis server

Linux Code
    1. $ src/redis-server

3.3 Playing the Redis client

Linux Code
    1. $ src/redis-cli
    2. Redis> set Foo Bar
    3. Ok
    4. Redis> get foo
    5. "Bar"

3.4 Installing the Redis service

Linux Code
    1. $ sudo make install

4. If you use utils/install_server.sh to generate initialization scripts , configuration Files , install and start Services , you can significantly save time on configuration. But before you use it, take a look at its implementation (note: The service is already part of the system and will start automatically when the system restarts!) )

Linux Code
    1. $ sudo sh install_server.sh

5. Before you modify the default configuration properties, browse redis.conf. To modify some of the default configuration properties, refer to Redis configuration for more detailed information on documentation's administration topics

6. "Redis as an LRU cache", Redis as a configuration reference for LRU caches (content is valuable!) )

redis.conf Code
    1. MaxClients 65536
    2. MaxMemory 128MB
    3. Maxmemory-policy ALLKEYS-LRU
    4. Maxmemory-samples 10
    5. # comment out all the trigger rules for the RDB
    6. #save 900 1
    7. #save 300 10
    8. #save 60 10000

7. "Master-slave" master-slave configuration changes, please refer to the south of the complete Redis springside4 "Appendix 1: Redis.conf Default configuration Modification"

redis.conf Code
    1. Daemonize Yes

8. Once the relevant properties in redis.conf have been modified, the utils/install_server.sh script can be executed.

9. Using the sudo netstat -anp | grep Redis "To confirm that all Redis services have been successfully started

At this point, all Redis services are started.

Redis Service Rapid Deployment

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.