High Performance Website Architecture Design cache Chapter (1)-Redis installation and use

Source: Internet
Author: User
Tags gz file redis version

One, what Redis

RE Mote DI ctionary S Erver, referred to as Redis, is a memcached-like key-value storage System. Compared to memcached, it supports richer data structures, including string (String), list (linked list ), set (set), Zset (sorted set-ordered set), and hash (hash type). and provides a data persistence mechanism in which you can use it as a non-relational database in some scenarios. It is a high-performance storage system capable of supporting more than 100k+ per second of read and write frequency. It also supports the publication/subscription of messages, giving you another option when building a high-performance Message Queuing system.

Second, download

Click here to download.

I am downloading the redis-3.0.0-beta5 version here, and Redis supports the cluster starting from 3.0.

Third, installation

The following installations are all steps on the OSX operating system:

1. Find the redis-3.0.0-beta5.tar.gz file you just downloaded and unzip the file.

2. Copy the extracted folder to a directory that you can easily find, and modify the folder name to Redis because the version number is too long.

2. Open the terminal and enter the Redis folder with the following command:

Last Login:fri-21:33:25 on ttys000

zhaoguihuadediannao:~ zhaogh$ CD Applications/dev/redis

Zhaoguihuadediannao:redis zhaogh$

3. Enter the make command at the command prompt and wait a few moments for the installation to complete. If you are prompted not to find the make command, refer to this article.

installed, is not a little excited. Smoke a cigarette, let's go on.

Iv. Use of

1, start the service, first enter the SRC directory, and then execute redis-server.

Zhaoguihuadediannao:redis zhaogh$ CD src

Zhaoguihuadediannao:src zhaogh$./redis-server

You will see:

2343:m 21:42:50.741 # Server started, Redis version 2.9.54

2343:m-21:42:50.741 * The server is now a ready-to-accept connections on port 6379

I'm not mistaken, TMD. 3.0.0, how do i show Redis version 2.9.54? Well, that's not the point, I'm too lazy to pursue it.

6379 is the Redis default port, and in subsequent articles you will know how to modify this default port.

2, the client connection.

You will find that after the fourth step, we can no longer execute other commands, how to do? Because Redis is monopolizing this process, it tells you later if you modify it to run in the background.

Let's open up another terminal for a moment. or enter the SRC directory first:

zhaoguihuadediannao:~ zhaogh$ CD APPLICATIONS/DEV/REDIS/SRC

ZHAOGUIHUADEDIANNAO:SRC zhaogh$

Enter the./REDIS-CLI command:

Zhaoguihuadediannao:src zhaogh$./redis-cli

127.0.0.1:6379>

It's already connected, hahaha.

3. Test several Redis commands:

127.0.0.1:6379> Set testkey001 testkey001

Ok

127.0.0.1:6379> Get testkey001

"Testkey001"

127.0.0.1:6379> Append testkey001 AAA

(integer) 13

127.0.0.1:6379> Get testkey001

"Testkey001aaa"

127.0.0.1:6379>

4. Close the connection and execute the QUIT command

127.0.0.1:6379> quit

ZHAOGUIHUADEDIANNAO:SRC zhaogh$

5, close the service.

Since we have just exited the client, we connect again and execute the shutdown command:

127.0.0.1:6379> shutdown

127.0.0.1:6379>

See if another terminal window shows [process completed]. Of course, you can also turn off the service by using the KILL command.

So much for today, and next you'll see how to use the C # Client API to manipulate Redis.

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.