ArticleDirectory
1. Active replication avoids redis replication defects.
2. Online redis resizing through presharding.
The previous article discussed common data types and storage mechanisms of redis. This article will discuss the
I have been paying attention to new news in the nosql field for a long time. I was listening to my colleagues a few days ago saying that redis can be used for data storage in our group. I hope my colleagues can check that there is nothing to do at
I,Principle
RedisThe master-slave replication function is very powerful.MasterYou can have multipleSlaveAndSlaveYou can have multipleSlaveIn this way, a powerful multi-level server cluster architecture is formed. The following is aboutRedisSome
First, configure the environment. Here we will not talk about the redis server and the redis PHP extension package;
View code
Require 'Redis. php '; Require 'Redis _ pool. php '; Require 'Redis _ peer. php '; Class Note Extends Redis_peer {} $
Redis is a key-value storage system. Similar to memcached, memcached supports more storage value types, including string, list, set, and zset ). These data types support push/pop, Add/Remove, Intersection Set and difference set, and more abundant
I. memcache
1. memecache stores all the data in the memory. After the power is down, the data cannot exceed the memory size.Some redis instances are stored on the hard disk to ensure data persistence.
2. memcache uses the memory allocation
I. Install the redis server first
Redis is a high-performance Key-value database. The emergence of redis largely compensates for the shortage of keyValue storage such as memcached, and can play a very good complementary role in relational
Redis is short and concise, and the Swiss army knife in the system. I have studied its source code and gained a lot.
1: network framework
2: exquisite implementation of various data structures
3: Persistence
4: Copy
Network Framework
The redis
Apsaradb for redis is a powerful nosql database. Compared with memcached, apsaradb for redis provides richer data types, including string, hash, list, set, and sorted set. It also supports data persistence. The optical string type is more powerful
Common redis Data Types
Redis has the following data types:
String
Hash
List
Set
Sorted set
Before describing these data types, let's take a look at how redis's internal memory management describes these different data types:
First, redis
1. Simplified commands
Analysis: commands in redis Communication Protocol use the original set, get, hset, hget, and other strings, it can be replaced by a single byte, such as 0x01, 0x02, 0x03, and 0x04.
Benefits: reduces network transmission
Many operations in node. js are asynchronous, so there are pre-and post-dependent asynchronous operations, and the subsequent operations must be written into the callback function.
For example, to operate redis, set a key and obtain the value of
Several misunderstandings about redis
Http://timyang.net/data/redis-misunderstanding/
A major system fault occurred on Weibo a few days ago, and many technical friends are concerned about it. The reason is not as high as James Hamilton's on design
Introduction
Redis encapsulation of Linux socket, although it also contains encapsulation of UNIX socket, but generally uses TCP socket. Similar to epoll encapsulation in the previous article, epoll uses the underlying socket function to complete
Introduction
Because there is no string type in Standard C, Redis implements its own string sds.Source File
Sds. h sds. cAnalyze Data Structure
// Sds type typedef char * sds; // sdshdr structure struct sdshdr {// The length occupied by the buf
(1) test environment
CPU
Dualcore e5800 X2 3.2g
Memory
4G
OS
SuSE Linux Enterprise Server 11 (x86_64)
Client
Jedis
(2) Insert a single value
Insert:
Key = (1000000-10000051) vaue = (1000000-10000051)
Client thread
Insert volume
Document directory
4.2 Use scp to copy files and directories
4.3 configure redis. conf for slave
5.1 start the server
5.2 Test Synchronization
1. Introduction
Redis is a key-value storage system. Similar to Memcached, Memcached supports more
Extract some of the resources (http://blog.nosqlfan.com/html/3537.html) on nosqlfans, used for a year, will only install, start and get set, really sorry to say will redis
REmote DIctionary Server (Redis) is a key-value storage system written by
Redis is a high-performance key-value database. The emergence of redis largely compensates for the shortage of keyvalue storage such as memcached, and can play a good complementary role in relational databases in some cases. It provides Python, Ruby,
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.