Redis is a single process single-threaded server that is implemented using multiple IO multiplexing technology, that is, event-based.
Redis are divided into two types of events, file time and time events.
File events: The traditional IO operation,
Test in: Redis2.6.17 | CentOS 5.7
installation: download Redis directly on Linux via wget mode
wget http://download.redis.io/releases/redis-2.6.17.tar.gzUnzip the downloaded redis-2.6.17.tar.gz file
TAR-ZXVF redis-2.6.17.tar.gzinto the unpacked
To write the Redis inside the K-line, and the line, think should be able to both types exist in a database (db), and to distinguish between the two.
Looked up some information, finally found, the feeling is quite practical, do a record, lest forget.
The project needs, the evil fill up a bit, share for everyone, as an introduction to understand
1. Redis with C development, more than 30,000 lines. Latest Version: 3.2.1
2. Support Type: string (within 512M), hash, list, set, ordered set
3.redis
1, master-slave problem
Core system: The company previously developed its own deployed REDIS3 3 from 3 Sentinels, program-end fragmentation, and deployed Sentinels to the Lord.
Just the main one hung, causing the entire system to be
Redis Single-Thread architecture
1 Single Thread model
Each invocation of the Redis client to the server goes through the sending command, executing the command, and returning the result in three processes. Where the command phase is executed,
1. What are the benefits of using Redis?
(1) Fast, because the data exists in memory, similar to the Hashmap,hashmap advantage is to find and manipulate the time complexity is O (1)
(2) Support rich data type, support string,list,set,sorted Set,hash
First of all, to install Redis in the local, specific view (Mac installation): http://blog.csdn.net/kirito_j/article/details/79079411
Project Environment: MAVEN,SPRINGMVC
Pom.xml
org.springframework.data
spring-data-redis
1.0.2.
In the Redis store Chinese, reading will appear garbled (in fact, not garbled, but not our saved Chinese display)
1 redis> set Test "US"
2 OK
3 redis> get test
4 "\xe6\x88\x91\xe4\xbb\xac"
How to get it in Chinese when it's taken. You just
This is to share with you the use of Redis in Springboot, where the Redis Jedis client is used (here I docker running Redis, can refer to Docker to quickly build several popular third-party services ), Add dependencies as follows:
redis.clients
Database types for 1.mysql and RedisMySQL is a relational database that is used primarily for persisting data, storing data on a hard disk, and reading slowly.Redis is a nosql, non-relational database, is also a cache database, the data is stored in
Redis installation Step1: Downloadwget http://download.redis.io/releases/redis-4.0.9.tar.gzStep2: UnzipTar xzf redis-4.0.9.tar.gzStep3: Move, put it on the usr/local recordsudo mv./redis-4.0.9/usr/local/redis/Step4: Into the Redis
The session is stored in the Redis database and needs to be configured in the settingDjango-redis Chinese Documentshttp://django-redis-chs.readthedocs.io/zh_CN/latest/#cache-backendWhen using django1.6+, the default session is stored in the Database
Using the shell to write a quick install Redis service#!/bin/bashyum Install CPP binutils glibc-kernheaders glibc-common glibc-devel gcc make wget #安装依赖库wget http://download . redis.io/releases/redis-4.0.1.tar.gzif [-f/root/redis-4.0.1.tar.gz];then
1. Download and installwget http://download.redis.io/releases/redis-4.0.11.tar.gz-zxvf redis-4.0.11. tar.gz CD Redis-4.0.11 make cd src//usr/local//usr/local//usr/local/ Redis installation complete ....2. Front-Startcd/usr/local/Redis.
Redis Official website: http://www.redis.io/download1. InstallationWget down installation package: wget http://download.redis.io/releases/redis-3.0.7.tar.gzDecompression: Tar xzf redis-3.0.7.tar.gzGo to Redis directory: CD redis-3.0.7Compiling Redis,
Installation:1. Get Redis Resourceswget http://download.redis.io/releases/redis-4.0.8.tar.gz2. UnzipTar xzvf redis-4.0.8.tar.gz3. InstallationCD redis-4.0.8MakeCD srcMake install Prefix=/usr/local/redis4. Move the configuration file to the
Thread IO ModelThe first thing to remember is that Redis is a single-threaded thread.Why is a single thread so fast?All Redis data is in memory, and all operations are memory-level operations, so the speed is faster than on-disk operations. But it
You can use memory as a cache, or you can use Redis as a cache, and the disadvantage of memory is that multiple instances of the cluster are not synchronized1, adding dependencies Dependency > groupId >org.springframework.bootgroupId>
Installing Python-redisPip Install RedisPython Operation Redis#To import a Redis class from a Redis package fromRedisImportRedis#initializing a Redis instanceCache = Redis (host='10.2.2.120', port='6379')#Manipulating StringsCache.set
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.