Introduction and installation of redis

Source: Internet
Author: User
Tags install redis
1. Introduction

Redis is a key-value storage system. Similar to memcached, memcached supports more storage value types, including string, list, set, and zset) and hash (hash type ). These data types support push/pop, Add/Remove, Intersection Set and difference set, and more abundant operations, and these operations are atomic. On this basis, redis supports sorting in different ways. Like memcached, data is cached in the memory to ensure efficiency. 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 is a high-performance Key-value database. The emergence of redis largely compensates for the shortage of key/value storage such as memcached. In some cases, it can play a good complementary role for relational databases. It provides clients such as Java, C/C ++, C #, PHP, JavaScript, Perl, object-C, Python, Ruby, and Erlang for ease of use.

Redis supports master-slave synchronization. Data can be synchronized from the master server to any number of slave servers. The slave server can be the master server associated with other slave servers. This allows redis to perform single-layer tree replication. Data can be written intentionally or unintentionally from a disk. Because the publishing/subscription mechanism is fully implemented, you can subscribe to a channel and receive the complete message publishing records of the master server when synchronizing the tree from the database anywhere. Synchronization is helpful for the scalability and data redundancy of read operations.

2. Install and install redis

Http://redis.io/
Official download: http://redis.io/download can download different versions as needed

Windows 32, 64-bit download (relatively low): https://github.com/dmajkic/redis/downloads
64-bit download: https://github.com/mythz/redis-windows

GitHub resources can be downloaded by zip directly (this is a friendly reminder for unknown users ).

Take https://github.com/dmajkic/redis/downloads
The following redis-2.4.5-win32-win64.zip is used as an example to describe the 32-bit installation method.

After the download is complete, you can right-click to extract to a hard disk such as F: \ redis-2.4.5-win32-win64

Copy the following 32bit to the installation directory. Here I install it to the root directory of disk F and rename the folder to redis.

Start redis


Run cmd to open the redis directory and then enable the Service (add redis. conf)

 redis-server.exe redis.conf 

The redis service is automatically closed when this window is enabled or disabled.

Test use

Do not close the window just opened, and start another window.
Run cmd to enter the redis directory and enter the following command. Note that-H is followed by your own IP address or 127.0.0.1.

 redis-cli.exe -h 127.0.0.1 -p 6379 

After the connection is successful, set the key-Value Pair:

 set key1 helloworld

Obtain

 get key1

Set redis as a Windows startup Item

Every time you open the command line to start redis, it will be very troublesome. If you set redis as a Windows Startup item, you do not need to enter the command line every time. In the redis directory, create a new start. BAT file whose content is

 F: cd F:\redis redis-server.exe redis.conf 

Create a new file redis_run.vbs with the following content:

 createobject("wscript.shell").run "F:\redis\start.bat",0

Drag redis_run.vbs to Windows startup to run it. Close the original redis startup cmd window and enter get key1 in the connection window to find it is OK. It will be automatically started next time it is started.

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.