Official documentation: So mysql should be started as follows:
redis:
Read more official documents, which contain detailed instructions Additional knowledge: Docker mounts files into the container and does not change after modification, so it needs to be restarted Today I found a very strange phenomenon. After I mounted the file on the host into docker, I deleted the file on the host and re-uploaded the file renamed to the same name, but the file in the container was not synchronized. Let's talk about Linux first. Linux storage is divided into iNode and block. iNode stores the file's attribute information, such as size and location on the disk. Block is a 4k block that stores the actual information of the file. Files less than 4k in size will also occupy 4k of space. After understanding the above, let's talk about docker. The file mounted into docker is actually an iNode remembered by docker. It can find the block, that is, the actual file information, through this iNode. If you use > to append redirection to write the file, it can be synchronized to docker. However, if you rename it with rm, the iNode of the file will change, but the iNode in docker still points to the previous disk location, so the file has not changed. rm principle: rm only deletes the iNode. Without the iNode, the block on the disk cannot be found in the normal way. It looks like it has been deleted, but the file information is still there. The file information will be overwritten the next time it is written here. Therefore, there is a way to recover the deleted data. However, if the file is open when it is deleted, the file will not be deleted. The same is true for vim. When you create a vim file, it copies the existing file. There will be a file at the same level directory that starts with . and ends with swp. When you save and exit, vim will delete the source file and rename this file to the name of the source file, and the iNode will naturally change. The above article on solving the problem of mysql data loss when restarting redis in docker is all the content that the editor shares with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
>>: SQL Server Comment Shortcut Key Operation
Table of contents 1. HTTP Range Request 1.1 Range...
Preface: The importance of database backup is sel...
Table of contents JSON appears Json structure Jso...
Table of contents Component recursive call Using ...
Overview of Alibaba Cloud Security Group Sharing ...
1. Differences in network configuration between C...
In the UI cutting process, the page is often comp...
What is CSS# CSS (abbreviation of Cascading Style...
Because I need to use Ubuntu+Python 3.6 version t...
When deploying uwsgi+nginx proxy Django, access u...
After adding –subnet to Docker network Create, us...
mysql records time-consuming sql MySQL can record...
When users install MySQL database for the first t...
The question is referenced from: https://www.zhih...
Copy code The code is as follows: <iframe src=...