Home  >  Article  >  Backend Development  >  Share 2 ways to install redis under Ubuntu

Share 2 ways to install redis under Ubuntu

高洛峰
高洛峰Original
2017-02-08 09:32:051371browse

Preface

Redis is currently recognized as the fastest memory-based key-value database, but the shortcomings of redis are also very obvious. It only provides the most basic hash set, list, sorted set and other data-based data. Type, no table classification, no schema, no index, no foreign key, lack of basic data types such as int/date, multi-condition query needs to be implemented indirectly through collection inlining (sinter, zinterstore) and connection, which is inconvenient to operate and low in development efficiency. The maintainability is not good; therefore, it is generally not used as a complete database alone. Many websites use redis as a cache and session state storage layer, and then use it with other databases.

Note: This article installs version 3.0.6, you can download the latest stable version from https://redis.io/download

Method 1

$ wget http://download.redis.io/releases/redis-3.0.6.tar.gz
$ tar xzf redis-3.0.6.tar.gz
$ cd redis-3.0.6
$ make
$ cd src

After make, the redis-server service program and redis-cli client program will appear in the redis-3.0.6/src directory. Copy redis-3.0.6/redis.conf to the src directory

Start the redis server

./redis-server redis.conf

At this time open another terminal and start the client Terminal

./redis-cli

Test run

127.0.0.1:6379> set name tom
OK
127.0.0.1:6379> get name
"tom"
127.0.0.1:6379>

The installation was successful.

Method 2

Use the following commands to install online

$sudo apt-get update
$sudo apt-get install redis-server

Start the redis server and client respectively

$ redis-server
$ redis-cli

Summary

The above is the entire content of this article. I hope the content of this article can bring some help to everyone's study or work. If you have any questions, you can leave a message to communicate. .

For more 2 ways to install redis under Ubuntu and share related articles, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn