Get the App
SLTechnology News&Howtos  ›  Database  › 

Detailed explanation of Redis installation tutorial under Linux

Shulou Source: shulou.com Published: 2022-06-01 04:30:08 09月22日 Update

I. installation environment

Redis is an open source high performance key-value pair (key-value) database developed in C language. It provides a variety of key data types to meet the storage needs of different scenarios. It is recommended to run on Linux. This tutorial uses Centos6.5 as the installation environment, using version 3.2.10 of redis. Official website of Redis

To install Redis, you need to compile the downloaded source code, which depends on gc++,. If you do not have a gc++ environment and need to install gcc, execute the command: yum install gcc-c++

II. Installation

Extract the source code, extract the redis installation package, and execute the command: tar-zxvf redis-3.2.10.tar.gz

* Note: I personally like to install the software in the / usr/local directory and execute the command: tar-zxvf redis-3.2.10.tar.gz-C / usr/local/redis

Go to the extracted directory to compile, and execute the command: make

Install to the specified directory, execute the command: make PREFIX=/usr/local/redis/redis-3.2.10 install, and you can see that there is an extra bin directory under this path

Copy the configuration file to the installation directory (for later startup), enter the extracted redis directory, where there is a configuration file reids.conf, and copy it to the installation directory bin directory

Execute the command:

Cp / usr/local/redis/redis-3.2.10/redis.conf / usr/local/redis/bin/redis-3.2.10

III. Redis start

Method 1: front-end startup mode, the disadvantage of front-end mode startup is that when the ssh command window closes, the redis-server program ends, and the current command window is in a blocking state, so you need to reopen a new command window if you want to execute other commands.

Execute the command: cd / usr/local/redis/redis-3.2.10/bin

Then execute the command:. / redis-server

Method 2: start in the backend mode and modify the redis.conf configuration file in the installation directory (that is, the bin directory). If the configuration file is not available, change daemonize no to daemonize yes according to step 4 of the installation step, as shown in the following figure:

And load the configuration file when the redis service starts:

Execute the command: cd / usr/local/redis/redis-3.2.10/bin

Then execute the command:. / redis-server redis.conf

After starting successfully, it is shown in the following figure:

4. Close Redis

First go to the redis installation directory (that is, the bin directory) and execute the command: cd / usr/local/redis/bin

Turn off redis:

Method 1: execute the command:. / redis-cli shutdown

You can also shut down based on the port number of the redis service

Method 2: execute the command:. / redis-cli-p 6379 shutdown

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Tags: Commands directories files configuration mode mode environment compilation front-end copy data source code services tutorials different success personal content slogans scenarios Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Linux Shulou Technology Shulou Tech Info NVidia