Get the App
SLTechnology News&Howtos  ›  Servers  › 

Sample Analysis of linux Environment deployment and docker installation of redis

Shulou Source: shulou.com Published: 2022-06-01 17:50:01 10月12日 Update

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!

Tags: Configuration container file command content password article environment example analysis success folder status input not much two location background most host Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MySQL Apple OPPO Reno Microsoft