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

Sample Analysis of linux Environment deployment and docker installation of redis

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you the linux environment deployment and docker installation of redis example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Installation steps

1. Install Redis

Download the redis image through docker search redis and docker pull redis

two。 Create a new mount configuration folder

Create two new folders, data and conf, at will.

Mkdir-p / root/docker/redis/datamkdir-p / root/docker/redis/conf

Note: because of the default configuration of redis, you will find that you can only connect locally, not access remotely, and you will get an error when using Redis Desktop Manager connection, so you need to mount the redis configuration file manually.

3. Add profile redis.conf

Create a new file redis.conf in the redis/conf you just created, as follows:

# bind 127.0.0.1 / / allow remote connection protected-mode no appendonly yes / / persist requirepass 123456 / / password

4. Create the redis container and launch

Execute the command as follows:

Docker run-- name myredis-p 6379Viru 6379-v / root/docker/redis/data:/data-v / root/docker/redis/conf/redis.conf:/etc/redis/redis.conf-d redis redis-server / etc/redis/redis.conf

The definition is as follows:

-name: give the container a name

-p: Port mapping host: container

-v: Mount custom configuration custom configuration: container internal configuration

-d: running in the background

Redis-server-- appendonly yes: execute the redis-server startup command in the container and open the redis persistent configuration

5. Start successfully. Check status.

Check the startup status through docker ps, whether it is successful or not

6. Test the internal connection of the container

Execute the docker exec-it my_redis redis-cli command to enter the terminal.

Log in via auth password.

Complete the command as follows:

[root@*** conf] # docker exec-it myredis redis-cli127.0.0.1:6379 > set name jfaith (error) NOAUTH Authentication required.127.0.0.1:6379 > auth 123456OK127.0.0.1:6379 > set name wangcaiOK127.0.0.1:6379 > get name "jfaith"

Note: if this error occurs: (error) NOAUTH Authentication required.

No password has been entered for verification. Please enter: auth your password

The above is all the contents of the article "sample Analysis of linux Environment deployment and docker installation redis". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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

Servers

Wechat

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

12
Report