Test and use of Redis in Windows using NoSQL, nosqlredis
About NoSQL
Before introducing Redis, I 'd like to know NoSQL, that is, not only SQL, which is a non-relational data storage and key/value pair storage. Existing Nosql DB products: redis/MongoDB/Memcached/Hbase/Cassandra/Tokyo Cabinet/Voldemort/Dynomite/Riak/CouchDB/Hypertable/Flare/Tin/Lightcloud/KiokuDB/Scalaris/Kai/ThruDB, and so on ~~~
Why do we need NoSQL non-relational databases?
- High performance-High concurrency read/write requirements for Databases
- Huge Storage-high-efficiency Storage and access to massive data
- High Scalability & High Availability-High Scalability and High Availability requirements for Databases
Redis Introduction
Why does Redis have Membercache and various databases? Redis is generated purely for applications. It is a high-performance key-value database. The emergence of redis largely compensates for the shortage of keyvalue storage such as memcached, and solves the situation that data is completely lost after power disconnection. In some cases, it can play a good complementary role for relational databases. The performance test results indicate that the SET operation can be up to 110000 times per second, and the GET operation can be performed 81000 times per second (of course, different server configurations have different performance ).
Redis is a distributed NoSQL Database System Oriented to "key/value" pairs of data types. It features high performance and persistent storage, and is suitable for high-concurrency application scenarios. Similar to Memcached, Memcached supports more storage value types, including string, list, set, and zset ). These data types support push/pop, add/remove, intersection union and difference set, and richer operations. These operations are atomic and support sorting in different ways. Redis is the same as memcached. To ensure efficiency, data is cached in the memory. The difference is that redis periodically writes the updated data to the disk or writes the modification operation to the append record file, and on this basis implements master-slave (master-slave) synchronization.
Redis currently provides four data types: string, list, set, and zset (sorted set ).
Redis storage is divided into three parts: memory storage, disk storage, and log files. The configuration file contains three parameters for configuration.
Install and use Redis in Windows
First download redis online, I downloaded a redis-2.0.2, I decompressed to the same directory as installing Python, enter the redis-2.0.2, the following files:
Daemon boot program for redis-server.exe redis Server
Redis. conf redis configuration file
Redis-cli.exe redis command line tool. Of course, you can also use telnet to operate based on its plain text protocol.
Redis-check-dump.exe local database check
Redis-check-aof.exe Update log check
Redis-benchmark.exe performance testing to simulate sending M SETs/GETs queries simultaneously by N clients (similar to Apache's AB tool)
Benchmark tool test information:
Sends 0.1 million requests to the redis server, each with 60 concurrent clients
My computer is a little overwhelmed, but it still shows that 4.03 requests were tested in 0.1 million seconds,
Some results are as follows:
Start Redis Service(Conf file configuration file (redis-server.exe redis. conf), if not specified, the default value is ):
The cmd window must be open all the time. When it is closed, the Redis service will be closed.
When the service is enabled, another cmd window is opened to set the client:
C: \ redis-2.0.2> redis-cli.exe-h 127.0.0.1-p 6379
Then we can enter the command we want to enter here. A very important operation of redis is set and get.
The client is as follows:
In this case, the server (which is also a local machine) is shown as follows (a client is connected ):
The key set on the client is resident memory, that is, the window is closed. The value of the get key in the next window is still "jzhou.
(During the operation, the server must enable the Service; otherwise, the client cannot be connected .)
Redis provides clients in multiple languages, including Java, C ++, and python.