This paper gives a general analysis of the application scenarios and characteristics of Redis, and makes a detailed analysis of the usage scenarios of the common data types of the APSARADB and the aspects of memory optimization and performance optimization. Redis Common data typesThe most commonly used data types of Redis
Redis is currently the NoSQL field of the popular fried chicken, it is like a Swiss Army knife, small, sharp, practical, especially suitable for the use of traditional relational database difficult to solve problems. But Redis is not a silver bullet, there are many problems that are suitable for it, but there are many problems that are not suitable for it to solve. In addition,
In the use of Redis process, we found that a lot of redis different from the memcached, but also different from the characteristics of MySQL.(This article mainly discusses Redis is not enabled for VM support) 1. Schema
MySQL: Need to design beforehandMemcached: No design requiredRedis: Small systems can be used, but if you want to plan and use
,smembers,sunion and so on.Application Scenarios:The functionality provided by Redis set externally is a list-like function, except that set is automatically weight-saving, and when you need to store a list of data and you don't want duplicate data, set is a good choice, and set provides the ability to determine if a member is in a set An important interface within the list, which is not available.Implementation method:The internal implementation of s
Reduces PHP Redis memory usage and phpredis memory usage
1. Advantages of reducing redis memory usage
1. It helps reduce the time used to create and load snapshots.
2. Improve the efficiency of loading AOF files and rewriting AOF files
3. shorten the time required for synchr
specified command.
2. redis master-slave replication:
Redis only needs to be configured on the slave server (slave:
Slaveof 211.122.11.11 6379 # specify the master's IP address and port
Masterauth Beijing # This is the password of the master host
Info # view the status of the Master/Slave server.
3. redis transaction processing:
Redis memory usage optimization and storageRedis crashes are really a headache.Redis memory optimization under LinuxRedis Memory storage Structure analysisRedis Common data typesThe most commonly used data types of Redis are the following five kinds:
String
Hash
List
Set
Sorted Set
Before describing these types of data, let's look at
configurationRedis-check-aof: Update log checkRedis-check-dump: for local data checking7. Start RedisA. Configuring the environment variables for RedisEcho ' Export path=/application/redis/bin: $PATH ' >>/etc/profileSource/etc/profileB. Creating a configuration file directory for RedisMkdir-p/application/redis/conf/CP-APR (Redis's extract directory) redis.conf/application/
/docs/redis/en/latest/Redis supports a wide range of clients, specifically for reference: Http://redis.io/clients. 4, how to help encounter errors! 1, Which:no tclsh8.5 .... Error[[email protected] redis-2.4.10]# make testCD src make testmake[1]: Entering directory '/data/software/redis-2.4.10/src 'which:no tclsh8.5 i
This article mainly introduces the PHP database operation Redis Usage, combined with the example form detailed analysis of PHP installation, the use of Redis procedures, methods and related considerations, the need for friends can refer to the following
Specific as follows:
Memcache Although easy to use, solve the database encountered high concurrency when the I
. SetCommon commands:Sadd,spop,smembers,sunion and so on.Application Scenarios:The functionality provided by Redis set externally is a list-like feature, except that set is automatically weight-saving, and set is a good choice when you need to store a list of data and you don't want duplicate data. and set provides an important interface to determine whether a member is within a set set, which is not available in list.Implementation method:The interna
. Since the partner has never provided access permissions to the redis server, only the permissions of the redis instance are available. By checking the redis configuration parameters provided by the partner's O M colleagues, we found that they set maxmemory 2 GB to limit the maximum memory usage of a single
:
The internal implementation of set is a value that is always null hashmap, which is actually calculated by hashing the way to fast weight, which is also set to provide a judge whether a member is within the cause of the collection.
Sort Set[HTML]View Plaincopy
5. Sorted Set
Common commands:
Zadd,zrange,zrem,zcard, etc.
Usage scenarios:
A condition is a weight, such as the number of times the top is sorted.
The Zrevrange
is a data structure server because Redis supports complex data features such as list, set, and so on. Different interpretations of the role of Redis determine how you use Redis.Internet data is currently used in two different ways to store, relational database or key value. But these internet services do not belong to these two types of data, such as the user's relationship in the social platform, it is a
always null hashmap, which is actually calculated by hashing the way to fast weight, which is also set to provide a judge whether a member is within the cause of the collection.
Sort Set[HTML]View PlainCopy
5. Sorted Set
Common commands:
Zadd,zrange,zrem,zcard, etc.
Usage scenarios:
A condition is a weight, such as the number of times the top is sorted.
The Zrevrange command can be used to get the top 100 users according to t
Windows Redis Installation and PHP usage
I. Installing REDIS and enabling services
1 Download Redis Client
?
Http://code.google.com/p/servicestack/wiki/RedisWindowsDownload#Download_32bit_Cygwin_builds_for_Windows
?
2 Unzip to the directory you need
?
3 Creating a redis.conf file
?
?
#
The Redis Cache server is a keyvalue database that reads 110000 s and writes 81000 s. it is fast because it is a memory operation, common usage is to store user tokens, text message verification codes, and other official websites to show that Redis itself does not have a Windows version, Microsoft officially developed a Windows-based
5 common usage Scenarios for Redis Submitmy comments
Load in have commented5 common usage Scenarios for Redis2015-07-23Database developmentDatabase Development Database Development number Dbdevs Function Introduction Share database-related technical articles, tutorials, and tools, plus database-related work. Occasionally talk about the programmer's life:
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.