Brief introduction and installation of Redis

Source: Internet
Author: User
Tags bz2 redis

What is a redis, what are the pros and cons, and what are the application scenarios

Redis is a high-performance NoSQL database based on memory, which can be used as a database, caching system and message middleware by storing data in the form of Key-value.

Supports multiple types of data structures, and can also support data persistence.

Redis, not omnipotent, has his own use of the scene and the scope of application.

Not suitable for the scene:

# It's not good for storing large scale data. We know that he is based on memory, although the memory is now very cheap, but every day has a lot of data, it is too much.

# is not very suitable for storing cold data, if the data access is very little, or the operation is very little, it is the waste of memory.

The right scene:

# cache: If only used as a cache, then he can replace memcached

# Counter: Global statistical techniques, such as the number of items browsing, like the number of

# Lottery in the dealer's website, second kill system

# Message Queuing

Installation of two Redis

2.1 Download or prepare Redis source pack

Redis-4.0.1.tar.gz

2.2 Inspection of installation environment

Check to see if gcc,gcc-c++ is installed, install if not installed

Yum install-y gcc gcc-c++

2.3 Check for the existence of environment variables malloc

If present, set the corresponding value libc or Jemalloc or other (manage memory fragmentation) as needed. If there is no default is Jemalloc. But your machine, if it's not installed,

Jemalloc, then you need to install it first. Otherwise there will be an error:

Error:jemalloc/jemalloc.h:no such file ordirectory

Installation steps:

# wget--no-check-certificatehttps://github.com/jemalloc/

jemalloc/releases/download/4.4.0/jemalloc-4.4.0.tar.bz2

# TAR-JXF JEMALLOC-4.4.0.TAR.BZ2

# If there is no configure, you need to call autogen.sh, generate configure, and if you already have it, execute it:

./configure--prefix=/usr/local/jemalloc

# Compile and install

Make && make install

If you don't want to use Jemalloc, then you have 22 choices:

First: Configure environment variables MALLOC=LIBC

Second: Add parameters when Redis make MALLOC=LIBC

2.4 Compile Installation

Make Malloc=/usr/local/jemalloc/lib/prefix=/opt/app/redis Install

malloc=/usr/local/jemalloc/lib/: Specify MALLOC value, you can also specify LIBC

Prefix=/opt/app/redis install: Where to install, that is, in which file to create a bin directory, which contains a variety of compiled commands

By default, these commands are stored in the SRC directory of the Redis source package.

2.5 Configuration Environment Redis_home

# Redis_home

Export Redis_home=/opt/app/redis

Export path= $PATH: $REDIS _home/bin

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.