Installation and use of Redis under Windows

Source: Internet
Author: User
Tags benchmark download redis redis server

About NoSQL

Before I introduce Redis, I'd like to know about NoSQL, not just SQL, which is a non-relational data store with Key/value key-value pairs. Existing NoSQL DB product: Redis/mongodb/memcached/hbase/cassandra/tokyo cabinet/voldemort/dynomite/riak/couchdb/hypertable/ FLARE/TIN/LIGHTCLOUD/KIOKUDB/SCALARIS/KAI/THRUDB, wait ~ ~ ~

Why do I need a nosql non-relational database?

    • High performance-demand for highly concurrent reads and writes to the database
    • Huge Storage-The need for efficient storage and access to massive amounts of data
    • High Scalability && High availability-requirements for database scalability and availability

About Redis

With Membercache and a variety of databases, why is Redis generated? Redis is purely for applications, and it is a high-performance Key-value database. The emergence of Redis, to a large extent, compensates for the memcached of such keyvalue storage, solves the situation that the data is completely lost after power outage, and in some cases can be a good complement to the relational database. The performance test results indicate that the set operation can be up to 110,000 times per second, and the get operation is 81,000 times/sec (of course different Server configuration performance differs).

Redis is a distributed NoSQL database system for "key/value" type data, characterized by high performance, persistent storage, and adapting to high concurrency scenarios. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), and Zset (ordered collection). These data types support Push/pop, Add/remove, and intersection sets and differences and richer operations, and these operations are atomic and support a variety of different ways of sorting. Redis is like memcached, where data is cached in memory to ensure efficiency. The difference is that Redis periodically writes the updated data to disk or writes the modified operation to the appended record file, and Master-slave (Master-Slave) synchronization is implemented on this basis.

Redis currently offers four types of data: String,list,set and Zset (sorted set).

The Redis storage is divided into memory storage, disk storage, and log files, which are configured with three parameters in the configuration file.

    1. Save seconds Updates: Indicates how many times the update operation has been synchronized to the data file.
    2. AppendOnly yes/no: Whether to log records after each update operation. If it is not turned on, it may result in loss of data over a period of time when power is lost. Because the Redis itself synchronizes data files in sync with the save conditions above, some data will only exist in memory for a period of time.
    3. Appendfsync no/always/everysec: How the data cache is synchronized to disk. No indicates that the data cache of the operating system is synchronized to disk, always indicates that the data is written to disk manually after each update operation, and EVERYSEC indicates that synchronization occurs every second.

Installation and use of Redis under Windows

First download Redis online, I downloaded redis-2.0.2 (http://download.csdn.net/download/linyu19872008/4179367), I unzipped to the same directory as the installation of Python, Enter the redis-2.0.2, and here are a few files:

Redis-server.exe Daemon Boot program for Redis server
redis.conf Redis configuration file
Redis-cli.exe Redis Command-line Operations tool. Of course, you can also use Telnet to manipulate it based on its plain text protocol.
Redis-check-dump.exe Local Database Check
Redis-check-aof.exe Update Log Check
Redis-benchmark.exe performance test to simulate the simultaneous sending of M-Sets/gets queries by n clients (similar to the Apache AB tool)

Benchmark Tool Test Information:

Send 100,000 requests to the Redis server with 60 concurrent clients per request

Gee, my computer is a bit too tired, but it finally showed 4.03 seconds to complete the 100,000 request test,

Some of the results are as follows:

start the Redis service (conf file development configuration file (Redis-server.exe redis.conf), default if not specified):

Start the cmd window to remain open, and the Redis service shuts down when it is closed.

When the service is open, another CMD window is opened and the client is set:

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, and one of the important things about Redis is set and get

The client is as follows:

At this point the server side (which is also native) appears as follows (one client is connected):

The above in the client set the key is resident memory, is to close the window, the next time to open the window get key value or "Jzhou", hehe.

(Note that the server must turn on the service, otherwise the client will not connect.) )

Redis provides clients in multiple languages, including Java,c++,python.

Python Operation Redis

To operate Redis in Python, you need to download a Redis Python Development Kit Redis-py (this web has https://github.com/andymccurdy/redis-py) After downloading it I put it in the Python installation directory, go to the Redis-py directory, execute setup.py (need to download setuptools, then execute python setup.py install OK)

Installed in a few seconds, into the Python environment, hehe, do something, to show that the Redis import success:

I quit CMD and want to import redis directly in the Python IDE, but the import failed, prompted that there is no module, I think, oh, I should add redis-py this path to the system environment variable, so python can recognize, if so, I will "C: \ Python27\redis-py ", joined the system path, and again in Python's own IDE to operate Redis successfully, so that you do not have to enter in the cmd that black box each time.

Installation and use of Redis under Windows

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.