Redis Getting -01

redis (Remote DIctionary Server) is written in C language development of key-value single-threaded (thread-safe) of nosql database.

scenes to be used

  1. Hot data cache.
  2. token or distributed session
  3. SMS verification code
  4. Distributed Lock
  5. Website counter
  6. Publish-Subscribe (not recommended)

Supported data types

  1. String: String
  2. Hash: Hash
  3. List: List
  4. Sorted Set: an ordered collection
  5. Set: collection

Master-slave replication

Scene: cluster, read and write separation, log backup, high availability

A master multi-slave (only one primary server): the primary server is responsible for both read and write operations, from the server is responsible for read operations.

principle

redis01.png

Configuration

From the server configuration:

#master ip及端口号
slaveof masterIP port
#master 密码
masterauth password

Sentinel mechanism

Scene: redis services heartbeat, failover, monitoring

Endurance of

RDB(Redis Database)

redis default persistent way open to binaries snapshot storage, and is based on a certain time point from time to time perform a persistence operations, real bad.

Suitable for large-scale data persistence and integrity of the data, the situation is less demanding consistency.

AOF(Append Only File)

Record each write operation to the server when the server restart will re-execute these commands to restore the original data, generally every 1s were aof file rewrite operations, data integrity, consistency is relatively high, taking up disk space is relatively large , recovery slower than RDB way.

Guess you like

Origin www.cnblogs.com/lspkenney/p/11433206.html