In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What this article shares to you is about how to achieve cross-Docker host storage. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
From the perspective of business data, containers can be divided into two categories: stateless containers and stateful containers.
Stateless means that the container does not need to save data during operation, and the result of each visit does not depend on the last visit, such as the web server that provides static pages.
Stateful means that the container needs to save data, and the data will change, and the result of access depends on the processing result of the previous request, the most typical is the database server.
Simply put, state is data, and if the container needs to process and store data, it is stateful, otherwise it is stateless.
For stateful containers, how do you save data?
We learned earlier in the Docker storage section that data volume can store the state of the container, but the volume discussed at that time is essentially the local directory of the Docker host.
There is a hidden danger in the local directory: if Docker Host goes down, how to restore the container?
One way is to back up the data regularly, but this solution still loses the data from the last backup to the downtime. A better solution is for a dedicated storage provider to provide volume,Docker to get the volume from the provider and mount it to the container. In this way, even if the Host fails, you can immediately launch the same mirror container on other available Host and mount the previously used volume, so that there is no data loss.
This chapter discusses in detail how to manage data volume across Docker hosts.
Start with an example
Suppose there are two Dokcer hosts, and Host1 runs a MySQL container, and data volume is provided by storage provider to protect the data, as shown in the following figure.
When Host1 fails, we start the same MySQL image on Host2 and mount data volume.
How does Docker implement this cross-host management data volume solution?
The answer is volume driver.
Any data volume is managed by driver, and if not specifically specified when the volume is created, a driver of type local is used, that is, storage space is allocated from the local directory of the Docker Host. If you want to support volume across hosts, you need to use a third-party driver.
At present, there are many driver available, such as driver using Azure File Storage and driver using GlusterFS. For a complete list, please see https://docs.docker.com/engine/extend/legacy_plugins/#volume-plugins
We will choose Rex-Ray driver here because:
Rex-Ray is open source and the community is active.
Support a variety of backend,VirtualBox Virtual Media, Amazon EBS, Ceph RBD, OpenStack Cinder and so on.
Supports multiple operating systems, including Ubuntu, CentOS, RHEL and CoreOS.
Supports a variety of container orchestration engines, Docker Swarm, Kubernetes and Mesos.
The installation and use of Rex-Ray is very simple.
The above is how to achieve cross-Docker host storage, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.