Redis Initial Knowledge: Installation

Source: Internet
Author: User
Tags redis cli

In the near future to use Redis, for this June was just heard, no use, now the technology update is too fast, every year there will be a lot of new technologies, learning ah ...

Cause

Let's start with the concept of Redis. Redis is an open source, written in ANSI C, support network, memory-based, persistent, key-value, and multi-lingual APIs. 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).
Before you know it, it's boring to just pull out some concepts. First install the use, and then slowly experience these conceptual things.

Download installation

The installation process is guided by the official guidelines step-by-step.
My environment is Ubuntu16.04. So the installation step is very simple, first download the source code, and then compile the installation.

wget http://download.redis.io/redis-stable.tar.gz

If you do not use the Wget tool, you can also download the source code compression package http://download.redis.io/redis-stable.tar.gz directly. The same, but I think wget tools are very useful.
Then unzip,

tar xvzf redis-stable.tar.gz


Once the decompression is complete, go to the extracted directory and compile with make.

cd redis-stablemake


After the compilation is complete, you can verify that the compilation is correct for insurance purposes.

make test


See final output "all tests passed without errors!" It's no problem.
At this point, Redis has been compiled to execute. The compiled files are saved in the SRC directory.

We can directly copy the relevant files to the bin of the system, or create an environment variable to this directory. such as:

sudo cp src/redis-server /usr/local/bin/sudo cp src/redis-cli /usr/local/bin/

Here "/usr/local/bin/" must be under your system path.
Or for the sake of convenience, you can install it directly using the following command.

sudo make install

Start

The above installation is complete and the installation can be verified below.

redis-server


Can see the last sentence,

The server is now a ready-to-accept connections on port 6379
You can learn that Redis listens on port 6379.

Of course, this startup is used without any explicit configuration files, and all parameters will use the internal default.

Check and easy to use

External programs communicate with Redis using TCP sockets and the Redis protocol. Although the protocol is implemented in different programming languages in the Redis client library. Redis, however, provides a simple command-line tool that can be used to send commands to Redis. That is, the Redis CLI.
The purpose of this is to check that Redis is the first thing that works by sending a ping command using the Redis command:

redis-cliping


Use the REDIS-CLI command to send this command to a Redis instance running on port 6379. Returning "PONG" indicates that the Redis instance started correctly.
Another interesting way to run REDIS-CLI is without parameters. This will start in interactive mode.

The above step is to add a "hello" key value to Redis and query it.

In this way, Redis is installed, and other features can be explored slowly.

Redis Initial Knowledge: Installation

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.