Get the App
SLTechnology News&Howtos  ›  Servers  › 

Install Redis in CentOS environment

Shulou Source: shulou.com Published: 2022-06-03 04:56:08 10月30日 Update

A brief and rough introduction to Redis

The following introduction comes from an encyclopedia:

Redis is an open source (BSD licensed), in-memory data structure storage system that can be used as database, cache, and messaging middleware. It supports many types of data structures, such as string (strings), hash (hashes), list (lists), set (sets), ordered set (sorted sets) and range query, bitmaps, hyperloglogs and geospatial (geospatial) index radius query. Redis has built-in replication (replication), LUA script (Lua scripting), LRU driven event (LRU eviction), transaction (transactions) and different levels of disk persistence (persistence), and provides high availability (high availability) through Redis Sentinel (Sentinel) and automatic partitioning (Cluster).

Back to the point:

1. Environmental preparation:

CentOS system: this article assumes that CentOS has been installed; if it is not installed, please refer to: https://blog.51cto.com/13886506/2441326

Redis installation package: http://download.redis.io/releases/redis-5.0.5.tar.gz

The latest version can be downloaded from the official website: https://redis.io/download

2. Transfer the downloaded installation package file to the CentOS server, and the tool for personal use is FinalShell. It can be downloaded from http://www.hostbuf.com/.

This software can drag and drop files directly to the corresponding directory.

3. Decompress the compressed package

Use the cd folder directory command to enter the folder where the package is located

Enter tar-xvf redis-5.0.4.tar.gz at the terminal and wait for the decompression program to finish.

4. Because the extracted file cannot be run directly on Linux, it is necessary to compile the extracted file.

Enter the make instruction at the terminal (the current folder is the decompressed file directory)

When the following figure appears, the compilation is complete:

5. Then start the installation

Enter make install to enter enter

6. Redis startup check

Enter redis-server to enter enter

Under normal circumstances, the following figure appears:

7. Modify redis configuration file

Enter vim redis.conf to enter enter

Enter the redis.conf file and press I to enter edit mode

Disable IP binding (about line 69)

7.2. Turn off protection mode (about line 88)

7.3. Enable background startup (about 136 lines)

Save exit: press ESC: wq enter

8. Restart input: redis-server redis.conf

9. Enter the client

Redis-cli [- p 6379] can be written in parentheses but not written, the default port does not need to write

10. Exit the client (all of the following three ways are available)

Ctrl+c exit quit

11. Close redis

Redis-cli [- p 6379] shutdown (not written in square brackets)

Attached:

Kill process

[root@localhost redis] # ps-ef | grep redis

Root 11446 1 0 19:02? 00:00:00 redis-server *: 6379

Root 11452 6743 0 19:03 pts/1 00:00:00 grep redis

[root@localhost redis] # kill-9 11446

[root@localhost redis] #

Tags: File input data folder directory but not following figure customer client data structure schema system terminal structure bracket query compile run different orderly Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple NVidia MySQL Xiaomi Shulou Technology