Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy redis on linux

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of how redis is deployed on linux, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will gain something after reading this article on how to deploy redis on linux. Let's take a look at it.

1. Download the Linux version of redis on the official website

two。 Copy it to the linux server and extract it to the specified directory

3. Get the redis folder after decompression-move to the file location you know

4. Note: redis is written in c language and needs to rely on c language environment

Yum install gcc-c++ tcl

Go to the redis installation directory

Execution

Make- compilation redis Note: there may be an error in the make compilation of redis6 and above, and you need to upgrade the gcc version # first step sudo yum install centos-release-scl# second step sudo yum install devtoolset-7-gcc*# third step scl enable devtoolset-7 bash

Finally, proceed.

Make install

5.redis default installation path use/local/bin

After compilation and installation, it will be in this directory

Redis-server server

Redis-cli client

6. We can copy the configuration file: redis.conf file under the redis installation directory to: use/local/redisconf/redis.con

Note: redisconf is a folder we created ourselves to place the configuration file error so that the program cannot be started (make a backup)

7. After completing the above steps, you can start redis

Redis-server / usr/local/rediscong/redis.confredis-cli---- launch client

8 some configuration parsing in redis.conf file

Bind 127.0.0.1 -:: 1 specifies that redis only receives requests from that IP address. In the configuration file redis.conf, the default bind interface is 127.0.0.1, which is the local loopback address. In this way, the redis service can only be accessed through a local client connection, not through a remote connection, which avoids exposing the redis service to a dangerous network environment and prevents some insecure people from casually connecting to the redis service remotely. If the bind option is empty, all connections from available network interfaces are accepted. (bind the ip of the network card on the server, not the ip of who wants to connect and bind. After binding the server network card, remote access can access redis as long as the Redis request from this network card address.) remote connection can adopt the method of specifying multiple IP. Example: bind 192.168.11.129 127.0.0.1 or: bind 0.0.0.0 ipv4 address on the server daemonize--- this configuration has two values yes/no daemon (daemon) is a kind of special process running in the background, used to perform specific system tasks. Many daemons start when the system boots and run until the system shuts down. Others start only when needed and end automatically after completing the task. When daemonize yes represents open daemon thread-daemon process turns on background startup, when daemonize no represents shutdown daemon thread protected-mode---, this configuration has two values yes/no protected mode, when protected-mode yes represents turn on protected mode-- (when no bind is specified for redis and no password is set, redis considers it unsafe. When protected mode is turned on, the function of protected mode is to allow access only to the local loopback address 127.0.0.1 and:: 1 (representation of the ipv6 loopback address). When protected-mode no represents turn off protected mode requirepass password--- set password set password in configuration file need to restart redis service client start 1redis service client enter command line 2:auth password--- enter password change redis password on client side: config set requirepass password view password: config get requirepass

Connection failure may occur when using RedisDesktopManager to connect to redis services

The solution to this problem is as follows

1. Make sure the bind settings are in the configuration file

two。 You need to set a password when you turn on protected mode

3. Modification of the configuration file requires the service to be restarted

Redis startup and shutdown

Redis startup command redis-server / usr/local/rediscong/redis.conf if you enter the command redis-server / usr/local/rediscong/redis.conf in the / user/local/rediscong/ directory, then the redis backup file will enter the client side redis-cli to execute shutdown in the / user/local/rediscong/dump.rdbredis close command. This is the end of the article on "how to deploy redis on linux". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to deploy redis on linux". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report