Share 2 ways to install redis under Ubuntu

  • 2020-05-15 02:30:19
  • OfStack

preface

redis is recognized as the fastest key/value pair database based on memory, but redis shortcoming is also very obvious, only provides the most basic hash set, list, sorted set based on data types, such as no table, no schema, no index, no foreign keys, lack of basic data types, such as int/date conditions more query need to set the inline (sinter, zinterstore) and indirect connection, inconvenient operation, low development efficiency, poor maintainability; So instead of treating it as a complete database to be used alone, many sites use redis as a caching and session state store layer and then use it in conjunction with other databases.

Note: this article is 3.0.6 version of installation, can go to the https: / / redis io/download download the latest stable version

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, in redis-3.0.6/src It will appear in the directory redis-server Service procedures and redis-cli Client program. will redis-3.0.6/redis.conf Copy to the src directory

Start the redis server


./redis-server redis.conf

At this point, open another terminal and start the client


./redis-cli 

A test run


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

Installation was successful.

Method 2

Install online using the following command


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

Start the redis server and the client, respectively


$ redis-server
$ redis-cli

conclusion

The above is the whole content of this article, I hope the content of this article to your study or work can bring 1 definite help, if you have questions you can leave a message to communicate.


Related articles: