Redis installation and configuration

Source: Internet
Author: User

Redis is a key-value storage system. Similar to memcached, memcached supports more storage value types, including string, list, set, and zset) and hash (hash type ). Today, I will share with you the installation and configuration of redis...

 

Introduction

Remote dictionary server (redis)
Redis is an open-source high-performance Key-Value Pair database. It provides a variety of key-value data types to meet the storage needs in different scenarios, and uses many high-level interfaces to make it competent for different roles such as cache and Queue Systems.

Redis is an open-source log-type and key-value database written in ansi c language that supports Network, memory-based persistence, and provides APIs in multiple languages.

Install

Http://redis.io/download download path

Command
$ wget http://download.redis.io/releases/redis-3.0.2.tar.gz$ tar xzf redis-3.0.2.tar.gz$ cd redis-3.0.2$ make
Start
$ src/redis-server
Client
$ src/redis-cliredis> set foo barOKredis> get foo"bar"
Configuration

Redis configuration example file in redis. conf under % redis_home %
It contains many default configurations.
The configuration can be as follows:

$ redis-server /etc/redis/6379.conf

Configuration item

If daemonize needs to run in the background, change this item to yespidfile to configure multiple PID addresses. The default value is/var/run/redis. pidbind: bind an IP address. After this parameter is set, only the port listening port of the request from this IP address is accepted. The default value is 6379 timeout. Set the timeout time for client connection. The unit is second-level loglevel, debug, verbose, notice, warninglogfile configure the log file address databases to set the number of databases. The default database is 0 save. Set the frequency of redis database mirroring and the frequency of snapshot storage. The first parameter indicates the length of time, and the second parameter indicates the number of write operations performed. Snapshots are automatically saved when a certain number of write operations are performed within a certain period of time. You can set multiple conditions. Rdbcompression, whether to compress the file name of the dbfilename image backup file dir database image backup file placement path slaveof set the database to another database from the database masterauth Password required for the master database connection verification requirepass set login needs to use the password maxclients limits the number of customers simultaneously connected maxmemory sets the maximum memory appendonly available for redis to enable append only mode appendfsync sets appendonly. aof file synchronization frequency VM-enabled whether virtual memory is supported VM-Swap-file set virtual memory swap file path VM-max-memory set redis maximum physical memory size VM- page-size sets page size of virtual memory VM-pages sets the total page quantity of swap files VM-max-threads sets the number of threads simultaneously used by vmio glueoutputbuf to store small output caches together hash-max-zipmap-entries sets the hash critical value activerehashing and re-Hash
Data Structure
1 string character type 2 hash Hash hash Type 3 list type 4 set type 5 sorted set Ordered Set
Three methods of redis Configuration

Redis startup parameter configuration

redis-server --port 6880

Load the configuration file at startup

redis-server /home/vagrant/redis-3.2.4/redis.conf

Config set dynamically loads some configuration files without restarting redis.

CONFIG SET loglevel warning
Redis multi-database
1. redis supports 16 databases by default. 2. Database 0 is automatically selected. You can use select to switch databases at any time. 3. redis does not support custom database names.

 

Redis installation and configuration

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.