In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "how to configure docker to use devicemapper". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Devicemapper best practices
Docker first ran on ubuntu and debian, using aufs memory. As docker is becoming more and more popular, many companies want to use it on RHEL, but aufs is not included in the upstream kernel, so rhel cannot use aufs. Finally, the developers developed a new back-end storage engine devicemapper, which is based on the existing Device Mapper technology and makes docker pluggable. Now there are many real cases around the world using devicemapper.
Mirror layer and sharing
Devicemapper stores each image and container on its own virtual device, which means that these devices are allocated on demand (copy-on-write snapshot devices), and Device Mapper technology works at the block level rather than the file level.
Devicemapper creates an image by:
Devicemapper creates a virtual pool based on block devices or loop mounted sparse files.
Then create an infrastructure device (base device) with a file system on it.
Each mirror layer is based on the COW snapshots (snapshot) of the underlying device, that is, these snapshots are initialized empty and take up space in the pool only when data is written.
Read operation of devicemapper
The application request block 0x44f in the container, because the container layer is also a virtual snapshot, no data is stored, only pointers. Find the mirror layer where the data is stored through the pointer.
Find the 0xf33 of layer a005e according to the pointer.
Devicemapper copy the data in it into the container memory.
The storage drive returns data to the requested application.
Write operation of devicemapper
Devicemapper writes are done through allocate-on-demand (allocation on demand). The data is updated by COW. Because devicemapper is a block-based technology, even if you modify a large file, it will not copy the whole file. Only the copy corresponds to the block to be modified.
Write new data
Write 56k data to the container:
The application requests to write 56k data to the container
Allocate a new 64k block at the container layer as needed. (if it exceeds 64k, more than one will be allocated)
Data is written to the newly allocated block
Modify data
Apply request to modify data in container
The cow operation navigates to the block to be updated
Allocate new blocks in the container layer and copy the data over
Make changes to the data
Configure docker to use devicemapper
Rhel-based branches use devicemapper by default and are configured to run in loop-lvm mode by default. This mode uses files as virtual pools (thin pool) to build layers of images and containers. But the production environment should not use this model.
Check through the docker info command
[root@srv00 ~] # docker info WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use`-- storage-opt dm.no_warn_on_loop_devices= true` to suppress this warning.... Data loop file: / var/lib/docker/devicemapper/devicemapper/data Metadata loop file: / var/lib/docker/devicemapper/devicemapper/metadata Library Version: 1.02.107-RHEL7 (2015-12-01).
Data loop file,Metadata loop file instructs docker to run in loop-lvm mode, and there is also a WARNING.
Configure direct-lvm mode for the production environment
Direct-lvm should be used in production environment. If an image was created in loop-lvm mode and needs to be switched, the image should be backed up. (push to hub or private registry)
I assign a 30g disk to the virtual machine
1. Stop docker daemon
[root@srv00 ~] # systemctl stop docker
two。 Create related logical volumes and thinpool
Create pv
[root@srv00 ~] # fdisk-l
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.