What is Redis?
Redis is a simple, efficient, distributed, memory-based cache tool.
Assuming a good server, provide key-value caching services over a network connection (similar to a database).
Simple, is the outstanding characteristic of Redis.
Simple to ensure that the core functions of stability and excellence.
Installation and configuration of Redis
Under Linux system:
Apt-get Install Redis-server
Under Windows:
Download link
Download the install MSI file just fine.
Configuring Master-Slave synchronization
You need to implement a distributed queue, at least one master (192.168.45.1) and one slave (192.168.45.130)
Linux default configuration file in/etc/redis/redis.conf
Master configuration:
bind 127.0.0.1
Slave configuration:
slaveof 192.168.45.1 6379
Then you can start the redis-server on each host separately.
Message Queuing mode
Pictures from the network, invasion and deletion
Use the Redis list type to save the data, and the queue takes the left-right out mode to guarantee the order of the queue messages.
Manipulating Redis data using Python
Import Redis
r= Redis. Redis (host= ' localhost ', port=6379, db=0) r.set ('
user ', ' Ioiogoo ') r.get ('
user ')
r.lpush (' queue:1 ', ' Task1 ')
r.brpop (' Queue:1 ', 3)
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.