This is the 10th day of my participation in the August More Text Challenge. For details, see:August is more challenging

Redisconcept

Redis is an open source project with BSD compliance, network support, in-memory, distributed, optional persistent key-value database storage, and apis in multiple languages. There are multiple data structures

redisFeatures:

Speed: data in memory, C language development, single thread

Persistent: Updates to data are saved asynchronously to disk

Multiple data structures: five data structures, and subsequent updates: BitMaps, Hyperloglog, and GEO

Support for multiple programming languages: Java, PHP, Python, Rub, GO, and more

Rich features: publish and subscribe, Lua scripts, Transactions, Pipeline

Simple: The original version has little code, no dependency on external libraries, and a single-threaded model

Master-slave replication: Provides the foundation for high availability and distribution

High availability and distributed: Redis-Sertinel(V2.8) supports high availability and Redis-Cluster(V3.0) supports distributed

redisTypical application scenarios

  • Caching system

  • counter

  • Message queuing system

  • list

  • The social network

  • Real-time systems

RedisInstallation:

redisInstallation (Linux)

Wget http://download.redis.io/releases/redis-3.0.7.tar.gz tar - XZF redis - 3.0.7. Tar. Gz ln -s redis - 3.0.7 redis CD redis make && make installCopy the code

RedisExecutable file Description

Redis-server // Start the redis server redis-cli // redis command line client redis-benchmark //Redis performance test tool redis-check-aof // aof file repair tool Redis-check-dump // Redis-sentinel // Redis-sentinelCopy the code

Three startup methods

  • Minimal startup: Redis-server uses the default configuration

  • Dynamic parameter start: redis-server –port 6380 Start by changing the port number

  • Start the configuration file: redis-server configPath

Verification method:

ps -ef | grep redis 
netstat -antpl | grep redis 
redis-cli -h ip -p port ping
Copy the code

Comparison of three boot modes

Build environment select configuration startup

Single-machine multi-instance profiles can be distinguished by ports

RedisClient connection

redis-cli -h ip -p port ping
Copy the code

RedisThe client returns a value

Status reply, error reply, integer reply, string reply, multi-line string reply

Redis Common configurations

Daemonize / / whether the daemon (no | yes) port / / Redis foreign port number The default port 6379 logfile / / Redis system log dir / / Redis working directoryCopy the code