Python redis and pythonredis
Preface: I originally wanted to write redis and rabbitMQ, but after writing redis, I feel a little bit more. rabbitMQ remains in the next blog ~~
For download and installation of redis and rabbitMQ, refer to
Install packageThere are 3 ways to install Redis https://github.com/andymccurdy/redis-py
The first type: into the virtual environment, the United? Install the package Redis
Pip Install Redis
The second type: into the virtual environment, the United installation package
configure the socket for the Twemproxy proxy? Don't worry, listen to me slowly.Install the TW agent on machines that need to connect to Redis. How do I install twemproxy? Transmission DoorConfigure after the installation is complete.cd/usr/local/twemproxy # go to twemproxy directory mkdir conf # Create CONF directory, default does not have this directory CD confvim Ethan.ymlethan: 0666 hash:fnv1a_64 "{}" Distribution:ketama
(linked list), set (set), Zset (sorted set-ordered collection), and hash (hash type). These data types support Push/pop, Add/remove, and intersection-set and difference sets, and richer operations, and these operations are atomic. Based on this, Redis supports sorting in a variety of different ways. As with memcached, data is cached in memory to ensure efficiency. The difference is that Redis periodically
Install redis in python and use python to operate the redis database. download the redis-py module github first. comandymccurdyredis-pyshell # wgetgithub. comandymccurdyredis-py [code] and decompress the package to run pythonsetup. the pyinstall installation module can be in
A simple Python script that monitors Redis performance has already talked about how to monitor memcached, and now incidentally how to monitor Redis. Let's start with the following information about monitoring redis:
Redis Ping: Verify Ping
Python -- Redis Set, python -- redisset1. unordered set
Set operation. The Set operation is a list that cannot be repeated.
1.1 sadd (name, values)
# Add elements to the set corresponding to name
1.2 smembers (name)
# Obtain all members of the set corresponding to name. sadd ('s1 ', 't1', 't2', 't3', 't1') print (r. smembers ('s1') # output {B 't1 ', B 't2',
//Returns all keys in the hash named user:002. >hvals user:002//Returns all values in the hash named user:002. >hgetall user:002//Returns all keys and values in the hash named user:002.Redis Advanced Utility featuresadd a password for RedisWarning: Because Redis is very fast, an external user can make a 150K password attempt in a second on a better server, which means you need to specify a very strong pas
page, but a page can not be shared by multiple objects,Vm-page-size is set according to the size of the stored data, the author suggests that if you store many small objects, the page size is preferably set to 32 or 64bytes;If you store very large objects, you can use a larger page, and if you are unsure, use the default valuesVm-page-size 3225. Set the number of pages in the swap file, since the page table (a bitmap that indicates that the page is idle or used) is in memory and consumes 1byte
first, RedisRedis is a key-value storage system. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), zset (sorted set-ordered collection), and hash (hash type). These data types support push/pop, add/remove, and Intersection-set and difference sets, and richer operations, and these operations are ATOMIC. Based on this, Redis supports sorting in a variety of different ways. As with memca
:6379> hmset myhash name fred age 24OK127.0.0.1:6379> hlen myhash(integer) 2127.0.0.1:6379> hlen nonhash(integer) 0Hdel commandThe Hdel command is used to delete the key specified by a hash, and if the key does not exist, no action is made. The return value of the Hdel command is the number of keys that were successfully deleted (not including nonexistent keys). The specific format is:hdel hash_name field:#示例127.0.0.1:6379> hmset myhash name fred age 24OK127.0.0.1:6379> hdel myhash name age(inte
1. Yum Install RedisYum Install RedisThe current version of Redis on Yum is 3.0.62. Yum Install/update pythonCentOS basically system comes with Python, update canInstallation: Yum Install PythonThe latest version of Python on Yum is now 2.6.63. Installing the Python module
wget--no-check-certificate https://py
, configure, VI Makefile, then add-fpic parameters after cflags, compile make and make install2, recompile libxml2,./configure–prefix=/usr/local/libxml2–with-zlib=/usr/local/zlib/Then VI Makefile, then add-fpic parameters after cflags, compile make and make installOklxml Installationall libxslt-develyum install libxslt-devel.x86_64pip install lxmlInstalling Scrapywget --no-check-certificate https://pypi.python.org/packages/source/S/Scrapy/Scrapy-1.0.3.tar.gz#md5=cefb981076a26112d6f9b76cb7e5ba7d
pressed, because scanning the mouse is blocked, then may never go to scan the keyboard;3. If a cycle needs to scan a lot of devices, which will lead to response time problems;So, the way is very bad. mode Two: is the event-driven modelmost of the current UI programming is an event-driven model, as many UI platforms provide the OnClick () event, which represents the mouse down event. The event-driven model is broadly thought of as follows:1. There is an event (message) queue;2. When the mouse is
Install packageThere are 3 ways to install Redis https://github.com/andymccurdy/redis-py
The first type: into the virtual environment, the United? Install the package Redis
Pip Install Redis
The second type: into the virtual environment, the United installation package
Directory
1 Preparatory work
2 Concrete Implementation
1 Preparatory workWhat is Redis?Redis: A high-performance Key-value database. Support data persistence, can save in-memory data on disk, restart can be loaded again to use, provide string, list, set, Zset, hash and other data structure of the storage, and support the backup.This article is suitable for scenarios where the amount of d
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.