directory
# Note that you must specify a directory is not a file name.
Dir./
################################# REPLICATION #################################
# Master-slave replication. Use slaveof to make a Redis instance a copy of
# another Redis server. Note that the configuration was local to the slave
# So for example it's possible to configure the slave to save the DB with a
# diff
console when starting reids-0 3) redis-2 sentinel console when starting the reids-2 Redis-2 sentinel console when starting reids-0 Redis-2 sentinel console when starting reids-1
The control output information on the console shows that when the service is started in sequence, the console outputs information such as + sentinel, + slave, and-sdown
Xinxing analyzes the configuration file in Redis, and Xinxing analyzes redis
The main configuration items in Redis are as follows:
(1) daemonize yes indicates whether to run in the background. If it is written as yes, it runs in the background. If it is no, it indicates that it does not run in the background.
(2) pidfile/var/run/
parameter, or keyreturn valuelong number of keys deleted. returns the number of key-values to be deleted. Examples $ redis-> set ('key1', 'val1'); $ redis-> set ('key2', 'val2 '); $ redis-> set ('key3', 'val3'); $ redis-> set ('key4', 'val4'); $ redis-> Delete ('key1 ', 'ke
Redis Research (12)-master-slave replication, redis research master-slave Replication
In the previous section, we wrote Redis data persistence.
Http://blog.csdn.net/wtyvhreal/article/details/42916503
Through the persistence function, Redis ensures that no (or a small amount of) data is lost even when the server is res
until the Redis virtual Memory feature is turned on, which is turned off by default.1) String
Common commands: Set/get/decr/incr/mget, etc.;
Application Scenario: String is the most commonly used data type, and ordinary key/value storage can be classified as such;
Implementation: string in the Redis internal storage By default is a string, refer
coherent command, and the last EXEC is the end (watch can be used to monitor some keys in this process ). For further analysis, commands in redis transactions will be pushed into the queue first, and commands will not be executed until the EXEC command appears. If the key of the watch monitoring changes, the transaction will fail. This means that there is no loc
length.Although the string is the basic value type of Redis, you can still do some interesting things with it. For example: Atomic increment:$ redis-cli Set counter 100OK $ redis-cli incr counter (integer) 101$ redis-cli incr counter (integer) 102$ redis-cli Incrby Counter
disk corruption, resulting in data loss, REDIS provides replication capabilities to automatically synchronize data from one primary database to the database to prevent data loss.Master-Slave principle:1. After starting the database, send the SYNC command to the primary database2. After the master database receives the SYNC command, it starts to save the snapshot, during which all commands issued to the pri
your system, which solves a lot of problems, such as the tasks that your existing database feels slow to handle. This allows you to optimize by Redis or create new features for the application. In this article, I want to explore how to add Redis to the existing environment, and use its primitive commands to solve some of the common problems encountered in the tr
environment1, First officer network Download Redis compressed package, address: Http://redis.io/download Download stable version 3.0.7 can.2, through the Remote management tool, the compressed package copy to the Linux server, to perform the decompression operation3. Perform make to compile files after Redis decompressionAfter compiling, you can see that the extracted file
allocate memory. This function is disabled by default.
1) String
Common commands: set/get/decr/incr/mget;
Application Scenario: String is the most common data type. Common key/value storage can be classified as this type;
Implementation Method: String is a String by default stored in redis and is referenced by redisObject. When an incr, decr, or other operation is performed, it is converted to a numeri
connection Redis:redis role for Master
[root@centos222 ~]# redis-cli
127.0.0.1:6379> auth 654321
OK
127.0.0.1:6379> info Replication
# Replication
role:master
connected_slaves:1
slave0:ip=192.168.1.224,port=6379,state=online,offset= 2088480,lag=1
master_repl_offset:2088623
repl_backlog_active:1
repl_backlog_size:1048576
repl _backlog_first_byte_offset:1040048
repl_backlog_histlen:1048576
# in 224 server connection Redis:redis role for slave
127.0.0.1:6379 0.0.0.0:* LISTEN# 通过启动命令检查Redis服务器状态~ sudo /etc/init.d/redis-server statusredis-server is running3. Accessing Redis from a command-line clientInstalling the Redis server will automatically install the Redis command-line client program t
environment1, First officer network Download Redis compressed package, address: Http://redis.io/download Download stable version 3.0.7 can.2, through the Remote management tool, the compressed package copy to the Linux server, to perform the decompression operation3. Perform make to compile files after Redis decompressionAfter compiling, you can see that the extracted file
data type a value object is, and encoding is how different data types are stored inside the Redis, such as: Type=string represents a normal string for value. Then the corresponding encoding can be raw or int, and if it is an int, it means that the actual redis is stored and represented by a numeric class, assuming that the string itself can be represented numerically, such as a string such as "123″" 456 ".
the conditions, but the SMS sending time of database updates is slow, the text message will be sent again.
To solve this problem in Redis, you only need to use the mobile phone number as the key to create a value with a life cycle of one minute. If the key does not exist, you can send text messages. If the key does not exist, you cannot send text messages:
def can_send(phone): key = "message:" + str(phone) if conn.set(key, 0, nx=True, ex=60):
Redis Summary-Redis installation, redis summary Installation
Redis needs to be used in recent projects. We will record the installation of Redis and how to use Redis in. NET within the past two days.
exists, each node gives itself a new ID.
[82462] 11:56:55.329 * No cluster configuration found, I ' m 97a3a64667477371c4479320d683e4c8db5858b1
This ID will always be used by this node as a unique identifier for this node throughout the cluster. The node distinguishes between other nodes and is identified by this ID, not IP or port. The IP can be changed, the port can be changed, but this ID cannot be changed until the node leaves the cluster. This ID is called the Node ID.
Second set:
T
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.