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 install and use redis in Linux system

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to install and use redis in the Linux system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

1. Download and decompress

Wget http://download.redis.io/releases/redis-3.2.6.tar.gz

2. Compile and install

A, compilation

Make

B, installation

Make install

3. Deployment of Redis

After the installation is successful, deploy Redis below

First of all, in order to facilitate management, move the conf configuration files and common commands in the Redis file to the unified file

Create bin and redis.conf files

Mkdir-p / usr/local/redis/binmkdir-p / usr/local/redis/ect

B. Move files

Mv redis.conf / usr/local/redis/ect/cd / srcmv mkreleasdhdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server / usr/local/redis/bin

4. Execute the Redis-server command to start the Redis service

Note: the Redis service started by Redis-server is executed directly here and runs directly in the foreground (the effect is shown above). That is to say, if Lunix closes the current session after executing the command, the Redis service is also shut down. Normally, starting the Redis service needs to be started from the background, and the startup configuration file is specified.

5. Start the redis service at the backend

a. First edit the conf file and change the daemonize property to yes (indicating that you need to run in the background)

Cd etc/vim redis.conf

b. Start the redis service again and specify the startup service profile to check whether it is started

Redis-server / usr/local/redis/ect/redis.conf

6. After the server starts successfully, execute redis-cli to start the Redis client and check the port number.

7. Redis sets password access

Vim / etc/redis.conf

Requirepass foobared removes the comments, foobared changes to his own password, and here I change to

Requirepass 123456

Then save and restart the service

Redis-server / usr/local/redis/ect/redis.conf

Test the connection:

. / redis-cli

Entering a command prompts (error) NOAUTH Authentication required. This is a normal phenomenon.

Input

Auth 123456

OK, it's done!

Note that when the client cannot access it, modify redis.conf and comment out bind 127.0.0.1

After reading the above, do you have any further understanding of how to install and use redis in Linux systems? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Wechat

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

12
Report