Docker installs redis 5.0.7 and mounts external configuration and data issues

Docker installs redis 5.0.7 and mounts external configuration and data issues

Redis is an open source NoSQL database written in ANSI C, supporting the network, memory-based and persistent log-type, Key-Value, and providing APIs in multiple languages.

environment

CentOS Linux release 7.7.1908 (Core)

Pull the redis 5.0.7 image

docker pull redis:5.0.7

Create a mount directory

mkdir -p /home/app/redis/conf
mkdir -p /home/app/redis/data

Download redis.conf

redis.conf address

Go into the directory and download redis.conf

cd /home/app/redis/conf
wget https://raw.githubusercontent.com/antirez/redis/5.0/redis.conf

Modify redis.conf

 Comment Symbols#
 1. Comment bind 127.0.0.1 
 2. Change protected-mode yes to protected-mode no
 3. Add requirepass yourpassword (Note: if you don’t add it, you can access without a password)
 Note:
  The purpose of step 1 and step 2 is to connect to redis remotely. If you only need local access, you don't need to modify it.

Create and start the container

docker run --restart=always -d --privileged=true -p 6379:6379 -v /home/app/redis/conf/redis.conf:/etc/redis/redis.conf -v /home/app/redis/data:/data --name redis redis:5.0.7 redis-server /etc/redis/redis.conf --appendonly yes

Parameter Explanation

--restart=always -> Start the container at boot, and automatically restart the container if it fails -d -> Start the container as a daemon --privileged=true -> Increase permissions in the container -p 6379:6379 -> Bind to the host port -v /home/app/redis/conf/redis.conf:/etc/redis/redis.conf -> Map configuration file -v /home/app/redis/data:/data -> Map data directory --name redis -> Specify container name --appendonly yes -> Enable data persistence

Summarize

The above is what I introduced to you about installing redis 5.0.7 in docker and mounting external configuration and data. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Docker builds Redis5.0 and mounts data

<<:  Detailed explanation of Bootstrap grid vertical and horizontal alignment

>>:  Windows10 mysql 8.0.12 non-installation version configuration startup method

Recommend

Detailed explanation of tinyMCE usage and experience

Detailed explanation of tinyMCE usage initializat...

View the number of files in each subfolder of a specified folder in Linux

count script #!/bin/sh numOfArgs=$# if [ $numOfAr...

Apache Bench stress testing tool implementation principle and usage analysis

1: Throughput (Requests per second) A quantitativ...

A detailed introduction to Linux system operation levels

Table of contents 1. Introduction to Linux system...

Analysis of common usage examples of MySQL process functions

This article uses examples to illustrate the comm...

Detailed explanation of Windows time server configuration method

Recently, I found that the company's server t...

Differences between MySQL MyISAM and InnoDB

the difference: 1. InnoDB supports transactions, ...

How to implement scheduled automatic backup of MySQL under CentOS7

The happiest thing that happens in a production e...

Search optimization knowledge to pay attention to in web design

1. Link layout of the new site homepage 1. The loc...

Mysql keeps the existing content and adds content later

This command modifies the data table ff_vod and a...

How to set up the terminal to run applications after Ubuntu starts

1. Enter start in the menu bar and click startup ...

Tips on HTML formatting and long files for web design

<br />Related articles: 9 practical suggesti...

W3C Tutorial (9): W3C XPath Activities

XPath is a language for selecting parts of XML do...

What are the benefits of using // instead of http:// (adaptive https)

//Default protocol /The use of the default protoc...