Docker solution to data storage problems

Source: Internet
Author: User

Currently, docker is gaining momentum in the cloud computing field. Every company, regardless of their size, has begun to study this open-source tool and technology. The number of open-source projects and start-ups around docker is also quite high, is a simple management of container web UI has many open source projects. But let alone say that docker must be a cluster for fun, and the bigger it is, the more fun it is. Of course, this is from the eyes of people playing technology. If there are still many problems to be solved in production, many solutions need to be designed and many fault tolerance needs to be handled. Today, I learned how docker solves the problem of data storage in containers. Previously, I encountered this problem in paas, but I also designed a corresponding solution to solve the problem. However, the volumes solution provided by docker seems to be more perfect and flexible, but the overall architecture and ideas are actually the same. The following is based on your understanding of docker volumes solution, the official documentation has a detailed instructions for use, if you want to try a, please Google or directly visit the official docker problem: https://docs.docker.com/userguide/dockervolumes/

Before introducing specific solutions, let's talk about the data storage problems of the programs running based on iner. Traditional software developers are used to using local disks to store files and other data. If the program crashes and restarts, the data is still there (when the hard disk is not bad ), you may say why you do not use cloud storage, distributed file systems, databases, or the like. First, developers in traditional industries may not accept or have access to cloud storage systems and concepts, second, small companies or individual developers may not be able to use their own cloud storage systems (third parties are often charged, and not necessarily useful), and the database is not suitable for storing files. Therefore, these problems need to be solved by the PAAs platform (whether public or private, of course docker is included here, if the PAAs platform is based on the container running application architecture, there is a local data storage problem. Because the PAAs platform needs to make rational use of resources, it needs to dynamically schedule the running program to run on different hosts. When the application is scheduled to run from one iner to another, how to ensure that the data is also migrated, And the migrated iner and the previous container may not be on the same host at all. Therefore, data migration is a big problem. It is not so easy to solve this problem elegantly.

First, let's take a look at how I used to solve this problem (in fact, you will find that the solution to docker is so astonishing). We provide developers with a directory, we promise that problems stored in this directory will not be lost in most cases (in extreme cases, some data may be lost, such as hard disk failure and data has not been backed up successfully yet, of course, there are also solutions, but at the expense of user experience and performance: Synchronous writing to cloud storage), then we have a file system listening agent that will monitor the changes to these directories, if there is a file change within a fixed interval, the directory will be regularly compressed into a compressed file and then uploaded to cloud storage, when your application is migrated to another container, you can download it from cloud storage and decompress it to the corresponding directory. In order to solve the frequent compression and upload operations caused by non-stop file writing, we set a time interval for these operations. If data is written during this interval and the compression and upload operations are not performed, the host fails or the hard disk breaks down, part of the data is lost. To solve the problem of uploading too many files to cloud storage, the old files are overwritten each time. That is, only one compressed file of an application is stored in cloud storage. Through this solution, we have solved more than 99% of data storage problems.

After reading more, go to www.wuyouqiang.com

Docker solution to data storage problems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.