Redis basic knowledge, installation, deployment, configuration Notes _ Basics

Source: Internet
Author: User
Tags download redis redis install redis redis server

Basic knowledge

1, the Redis data type:
strings, lists (lists), collections (sets), ordered sets (sorts sets), hash table (HASHS)
2, Redis and memcache compared to the unique place:
(1) Redis can be used to do storage (Storge), and Memcache is to do caching (cache). This feature is mainly because of its "persistent" function
(2) stored data has "structure", for memcache, the stored data, only one type-"string", while Redis can store strings, lists, sets, ordered sets, the structure of the Kazakh sequence
3, two ways of persistence:
Redis stores data in memory or is configured to use virtual memory.
Two ways of implementing data persistence:
(1) Use screenshots to keep the data in memory written to disk (high performance, but may cause a certain degree of data loss)
(2) Use a MySQL-like way to record every update of the log
4, Redis master-Slave synchronization: To improve read performance is very useful
5, the default port of the Redis server is 6379

Next, we'll install Redis.

1, first to Redis official website (redis.io) Download Redis installation package

2, download it to my/lamp directory
3, decompression and access to its directory

4. Compile source program

Copy Code code as follows:

Make
CD src
Make install Prefix=/usr/local/redis

5, move the configuration file to the Redis directory

6. Start Redis Service

7, the default, Redis is not running in the background, we need to put Redis in the background to run

Copy Code code as follows:

Vim/usr/local/redis/etc/redis.conf

Change the value of daemonize to Yes

8. Client Connection

Copy Code code as follows:

/usr/local/redis/bin/redis-cli

9. Stop Redis Instance

Copy Code code as follows:

/USR/LOCAL/REDIS/BIN/REDIS-CLI shutdown

Or
Copy Code code as follows:

Pkill Redis-server

10, let the Redis power-on self-starter
Copy Code code as follows:

Vim/etc/rc.local

Join
Copy Code code as follows:

/usr/local/redis/bin/redis-server/usr/local/redis/etc/redis-conf

11, next we look at a few files in the/usr/local/redis/bin directory what
Copy Code code as follows:

Redis-benchmark:redis Performance Testing Tool

REDIS-CHECK-AOF: Tools for checking aof logs

Redis-check-dump: Tools for checking RDB logs

REDIS-CLI: The client used for the connection

Redis-server:redis Service Process

Configuration of Redis

Daemonize: If you need to run in the background, change the value of the item to Yes

Pdifile: Put the PID file in the/var/run/redis.pid, can be configured to other addresses

Bind: Specifies that Redis receives only requests from this IP, and if not, all requests are processed, preferably set in the production chain

Port: Listening ports, defaults to 6379

Timeout: Set timeout for client connections, in seconds

LogLevel: Grades are divided into 4 levels, debug,revbose,notice and warning. General open notice in production environment

LogFile: Configure log file address, use standard output by default, that is, print on the port of command line terminal

Database: Set the number of databases, using the default database is 0

Save: Set the frequency of Redis for database mirroring

Rdbcompression: Whether to compress when making a mirrored backup

Dbfilename: The filename of the mirrored backup file

Dir: Path of file placement for database mirroring backup

Slaveof: Set this database to be a database from another database

Masterauth: When the primary database connection requires password verification, set here

Requirepass: Sets the password to be used before any other designation is made after the client connects

MaxClients: Limit the number of simultaneous clients

MaxMemory: Set the maximum memory that Redis can use

AppendOnly: When AppendOnly mode is turned on, Redis appends each received write to the appendonly.aof file, and when Redis restarts, the file is restored from the previous state

Appendfsync: Set the frequency of appendonly.aof files for synchronization

Vm_enabled: Open Virtual memory support

Vm_swap_file: Set the path of the swap file for virtual memory

Vm_max_momery: Sets the maximum amount of physical memory that Redis will use when virtual memory is turned on, by default of 0

Vm_page_size: Set the size of the virtual memory page

Vm_pages: Sets the total page number of the swap file

Vm_max_thrrads: Set the number of threads that VM IO uses simultaneously

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.