Files
doc-exports/docs/cce/umn/cce_faq_00096.html
Dong, Qiu Jian b05d81fd8b CCE UMN for 1.23 reuploaded -20221103
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
2022-11-10 19:50:29 +00:00

171 lines
18 KiB
HTML

<a name="cce_faq_00096"></a><a name="cce_faq_00096"></a>
<h1 class="topictitle1">How Do I Change the Mode of the Docker Device Mapper?</h1>
<div id="body0000001197314917"><p id="cce_faq_00096__p4808521595845">Currently, private CCE clusters use Device Mapper as the Docker storage driver.</p>
<p id="cce_faq_00096__p1091511295846">Device Mapper is developed based on the kernel framework and supports many advanced volume management technologies on Linux.</p>
<p id="cce_faq_00096__p2812146095846">Docker Device Mapper storage driver leverages the thin provisioning and snapshot capabilities of this framework to manage images and containers.</p>
<p id="cce_faq_00096__p111662039132616">For CCE clusters in v1.7.3-r6 or earlier versions, the Docker Device Mapper is set to the loop-lvm mode by default. By default, Docker generates data and metadata files in the <span class="filepath" id="cce_faq_00096__filepath2131101715162922"><b>/var/lib/docker/devicemapper/devicemapper</b></span> directory. The two files are attached to loop devices and used as block devices. After multiple containers are attached to the files, the performance deteriorates dramatically.</p>
<p id="cce_faq_00096__p532138492937">The loop-lvm mode enables you to use Docker out of the box, without additional configuration. This mode is not recommended in the production environment. The Docker Device Mapper also supports the direct-lvm mode. This mode enables you to use raw partitions (no file systems). In the medium-load and high-density environments, this mode provides better performance.</p>
<p id="cce_faq_00096__p2837899492937">To ensure system stability, you need to set the Docker Device Mapper to the direct-lvm mode.</p>
<p id="cce_faq_00096__p5952225611147">CCE allows you to change the mode of the Device Mapper on VM nodes running on EulerOS.</p>
<div class="notice" id="cce_faq_00096__note1927203153511"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="cce_faq_00096__ul62843120353"><li id="cce_faq_00096__li39243816113417">Changing the Docker Device Mapper mode on a node requires a data disk. Therefore, in the change process, the system automatically creates a 100 GB SATA disk and binds it to the node.</li><li id="cce_faq_00096__li1343318354">When the Docker Device Mapper mode on a node is changed to <strong id="cce_faq_00096__b84235270616634">direct-lvm</strong>, the container and image data on the node will be deleted. Therefore, you must back up the container and image data of the node to a private image repository or Docker Hub repository before changing the mode.</li></ul>
</div></div>
<div class="section" id="cce_faq_00096__section1552313010166"><h4 class="sectiontitle">Procedure</h4><ol id="cce_faq_00096__ol43649284104334"><li id="cce_faq_00096__li48682831104334"><span>Check whether the Docker Device Mapper mode on a node is <strong id="cce_faq_00096__b84235270616718">direct-lvm</strong>.</span><p><p id="cce_faq_00096__p3792722114410">Method 1:</p>
<ol type="a" id="cce_faq_00096__ol27685325104720"><li id="cce_faq_00096__li41079130104720">Log in to a node on which you want to view the Docker Device Mapper mode.</li><li id="cce_faq_00096__li18584616111543">Query the configuration information under <span class="parmname" id="cce_faq_00096__parmname19237647112048"><b>Storage-driver</b></span>.<div class="p" id="cce_faq_00096__p12150384284"><strong id="cce_faq_00096__b3725114982815">docker info</strong><ul id="cce_faq_00096__ul272403722811"><li id="cce_faq_00096__li1772315371289">If the values of the <span class="parmname" id="cce_faq_00096__parmname214734166916548"><b>Data file</b></span> and <span class="parmname" id="cce_faq_00096__parmname703637862165416"><b>Metadata file</b></span> parameters under <span class="parmname" id="cce_faq_00096__parmname515429785165429"><b>Storage-driver</b></span> are <span class="parmvalue" id="cce_faq_00096__parmvalue1302183852165440"><b>/dev/loopx</b></span>, the Docker Device Mapper mode of the current node is <strong id="cce_faq_00096__b84235270616835">loop-lvm</strong>. Change the mode by following <a href="#cce_faq_00096__li5148151113134">2</a>.<p id="cce_faq_00096__p072303722813">Example:</p>
<p id="cce_faq_00096__p11723173722811"><span><img id="cce_faq_00096__image57740832113250" src="en-us_image_0000001178352602.jpg"></span></p>
</li><li id="cce_faq_00096__li4724143718281">If the values of the <span class="parmname" id="cce_faq_00096__parmname1796047300165533"><b>Data file</b></span> and <span class="parmname" id="cce_faq_00096__parmname1073321661165533"><b>Metadata file</b></span> parameters under <span class="parmname" id="cce_faq_00096__parmname1496857972165533"><b>Storage-driver</b></span> are left blank and the value of <span class="parmname" id="cce_faq_00096__parmname1167794994165618"><b>Pool Name</b></span> is <span class="parmvalue" id="cce_faq_00096__parmvalue978605200165618"><b>vgpaas-thinpool</b></span>, the Docker Device Mapper mode of the current node is <strong id="cce_faq_00096__b84235270616937">direct-lvm</strong>. You do not need to change the mode.<p id="cce_faq_00096__p127241537102810">Example:</p>
<p id="cce_faq_00096__p7724143717283"><span><img id="cce_faq_00096__image41146022113222" src="en-us_image_0000001177874144.jpg"></span></p>
</li></ul>
</div>
</li></ol>
<p id="cce_faq_00096__p49733791114430">Method 2:</p>
<ol type="a" id="cce_faq_00096__ol38059865114446"><li id="cce_faq_00096__li63423559114446">Log in to a node on which you want to view the Docker Device Mapper mode.</li><li id="cce_faq_00096__li15154025114458">Check whether the following information is displayed:<div class="p" id="cce_faq_00096__p5182103312295"><a name="cce_faq_00096__li15154025114458"></a><a name="li15154025114458"></a><strong id="cce_faq_00096__b111244916293">cat /etc/docker/daemon.json</strong><pre class="screen" id="cce_faq_00096__screen1032173172913">"dm.thinpooldev=/dev/mapper/vgpaas-thinpool"</pre>
<ul id="cce_faq_00096__ul0321531182912"><li id="cce_faq_00096__li1732193192914">If the command output contains the preceding information, the Docker Device Mapper mode of the current node is <strong id="cce_faq_00096__b84235270616944">direct-lvm</strong>. You do not need to change the mode.</li><li id="cce_faq_00096__li73214318290">If the command output does not contain the preceding information or a message indicating that a file such as <span class="parmname" id="cce_faq_00096__parmname196715886917925"><b>daemon.json</b></span> is unavailable is displayed, the Docker Device Mapper mode of the current node is not <strong id="cce_faq_00096__b84235270616951">direct-lvm</strong>. Change the mode by following <a href="#cce_faq_00096__li5148151113134">2</a>.</li></ul>
</div>
</li></ol>
</p></li><li id="cce_faq_00096__li5148151113134"><a name="cce_faq_00096__li5148151113134"></a><a name="li5148151113134"></a><span>(Optional) If no elastic IP address is bound to the node for which the Docker Device Mapper mode needs to be changed, bind an elastic IP address.</span></li><li id="cce_faq_00096__li53078223115721"><span>Log in to the node with an elastic IP address as the root user.</span></li><li id="cce_faq_00096__li1582567912523"><span>Create a configuration file.</span><p><p id="cce_faq_00096__p199518415171"><strong id="cce_faq_00096__b59399133179">touch config.yaml</strong></p>
</p></li><li id="cce_faq_00096__li656236212544"><span>Copy the following content to the configuration file:</span><p><pre class="screen" id="cce_faq_00096__screen4083933121229">user:
domainName:
username:
password:
projectName:
apiGatewayIp:
iamHostname:
ecsHostname:
evsHostname:
swrAddr:
defaultPassword:
defaultPrivateKey:
hosts:
- host: &lt;node_ip_01&gt;
user: root
password:
privateKey:
serverId:
- host: &lt;node_ip_02&gt;
user: root
password:
privateKey:
serverId:</pre>
<div class="tablenoborder"><a name="cce_faq_00096__table43203543121749"></a><a name="table43203543121749"></a><table cellpadding="4" cellspacing="0" summary="" id="cce_faq_00096__table43203543121749" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="cce_faq_00096__row65292176121749"><th align="left" class="cellrowborder" colspan="2" valign="top" id="mcps1.3.9.2.5.2.2.2.4.1.1"><p id="cce_faq_00096__p17812310121749">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" id="mcps1.3.9.2.5.2.2.2.4.1.2"><p id="cce_faq_00096__p33510994121749">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="cce_faq_00096__row1888131121749"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p18720917121749">domainName</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p39999295121749">Tenant name</p>
</td>
</tr>
<tr id="cce_faq_00096__row34239615121749"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p21945454121749">username</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p32751345121749">User name</p>
</td>
</tr>
<tr id="cce_faq_00096__row52084219121749"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p58072192121749">password</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p6227126121749">User password, which is enclosed in quotation marks ('' '')</p>
</td>
</tr>
<tr id="cce_faq_00096__row43281388121749"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p16131571121749">projectName</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p31588837121749">Name of the project to which the to-be-configured node belongs</p>
</td>
</tr>
<tr id="cce_faq_00096__row9922323121749"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p65510708121749">apiGatewayIp</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p22247003122527">IP address of an API gateway</p>
</td>
</tr>
<tr id="cce_faq_00096__row52688566121749"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p39915452121749">iamHostname</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p35764110122642">Endpoint of the IAM service</p>
</td>
</tr>
<tr id="cce_faq_00096__row37120100121749"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p53938120121749">ecsHostname</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p33930085122819">Endpoint of the ECS service</p>
</td>
</tr>
<tr id="cce_faq_00096__row5455090121915"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p39209165121915">evsHostname</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p8980908122821">Endpoint of the EVS service</p>
</td>
</tr>
<tr id="cce_faq_00096__row3583828121915"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p21854665121915">swrAddr</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p30500755122852">Address of a software repository</p>
</td>
</tr>
<tr id="cce_faq_00096__row27594648121915"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p20573979121915">defaultPassword</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p55879640121915">(Optional) Default login password of a node. The value must be enclosed in quotation marks ('' '').</p>
</td>
</tr>
<tr id="cce_faq_00096__row45558794121916"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p66383670121916">defaultPrivateKey</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p8368215121916">(Optional) Absolute path to the default key file for logging in to a node. The value must be enclosed in quotation marks ('' '').</p>
</td>
</tr>
<tr id="cce_faq_00096__row59290514548"><td class="cellrowborder" colspan="2" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.1 "><p id="cce_faq_00096__p53647876145413">hosts</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.9.2.5.2.2.2.4.1.2 "><p id="cce_faq_00096__p832112014552">Host array structure [1]. You can set multiple nodes for which you want to change the Device Mapper mode. The following parameters must be included: <span class="parmvalue" id="cce_faq_00096__parmvalue2666781599311"><b>user</b></span>, <span class="parmvalue" id="cce_faq_00096__parmvalue17290617889311"><b>password/privateKey</b></span>, and <span class="parmvalue" id="cce_faq_00096__parmvalue12401233449311"><b>serverId</b></span>. For details about the host array structure, see <a href="#cce_faq_00096__table1718722614567">Table 2</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="cce_faq_00096__table1718722614567"></a><a name="table1718722614567"></a><table cellpadding="4" cellspacing="0" summary="" id="cce_faq_00096__table1718722614567" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description about the host array structure</caption><thead align="left"><tr id="cce_faq_00096__row3124120714567"><th align="left" class="cellrowborder" valign="top" width="41.72%" id="mcps1.3.9.2.5.2.3.2.3.1.1"><p id="cce_faq_00096__p44912539145617">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.28%" id="mcps1.3.9.2.5.2.3.2.3.1.2"><p id="cce_faq_00096__p27831315145617">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="cce_faq_00096__row2152667814567"><td class="cellrowborder" valign="top" width="41.72%" headers="mcps1.3.9.2.5.2.3.2.3.1.1 "><p id="cce_faq_00096__p61707268145639">host</p>
</td>
<td class="cellrowborder" valign="top" width="58.28%" headers="mcps1.3.9.2.5.2.3.2.3.1.2 "><p id="cce_faq_00096__p32232843145639">IP address of the node for which you want to change the Device Mapper mode. This node must be in the same subnet as the current logged-in node.</p>
</td>
</tr>
<tr id="cce_faq_00096__row6490579814567"><td class="cellrowborder" valign="top" width="41.72%" headers="mcps1.3.9.2.5.2.3.2.3.1.1 "><p id="cce_faq_00096__p42656363145639">user</p>
</td>
<td class="cellrowborder" valign="top" width="58.28%" headers="mcps1.3.9.2.5.2.3.2.3.1.2 "><p id="cce_faq_00096__p32613388145639">User name. Set this parameter to <strong id="cce_faq_00096__b8423527069547">root</strong>.</p>
</td>
</tr>
<tr id="cce_faq_00096__row4053437514567"><td class="cellrowborder" valign="top" width="41.72%" headers="mcps1.3.9.2.5.2.3.2.3.1.1 "><p id="cce_faq_00096__p32017230145639">password</p>
</td>
<td class="cellrowborder" valign="top" width="58.28%" headers="mcps1.3.9.2.5.2.3.2.3.1.2 "><p id="cce_faq_00096__p43258836145639">Password for the <strong id="cce_faq_00096__b8423527069617">root</strong> user on the node for which you want to change the Device Mapper mode. The value must be enclosed in quotation marks ('' '').</p>
<div class="note" id="cce_faq_00096__note53785205145639"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="cce_faq_00096__p14304798145639">Set either <strong id="cce_faq_00096__b842352706971">password</strong> or <strong id="cce_faq_00096__b842352706976">privateKey</strong>.</p>
</div></div>
</td>
</tr>
<tr id="cce_faq_00096__row3799907814567"><td class="cellrowborder" valign="top" width="41.72%" headers="mcps1.3.9.2.5.2.3.2.3.1.1 "><p id="cce_faq_00096__p51871520145639">privateKey</p>
</td>
<td class="cellrowborder" valign="top" width="58.28%" headers="mcps1.3.9.2.5.2.3.2.3.1.2 "><p id="cce_faq_00096__p40843621145639">Absolute path to the key file of the <strong id="cce_faq_00096__b8423527069727">root</strong> user on the node for which you want to change the Device Mapper mode. The value must be enclosed in quotation marks ('' '').</p>
<div class="note" id="cce_faq_00096__note32048275145639"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="cce_faq_00096__p19999027145639">Set either <strong id="cce_faq_00096__b19644629">password</strong> or <strong id="cce_faq_00096__b2122582263">privateKey</strong>.</p>
</div></div>
</td>
</tr>
<tr id="cce_faq_00096__row2953951614567"><td class="cellrowborder" valign="top" width="41.72%" headers="mcps1.3.9.2.5.2.3.2.3.1.1 "><p id="cce_faq_00096__p7875779145639">serverId</p>
</td>
<td class="cellrowborder" valign="top" width="58.28%" headers="mcps1.3.9.2.5.2.3.2.3.1.2 "><p id="cce_faq_00096__p33958353145639">ID of the ECS corresponding to the node for which you want to change the Device Mapper mode</p>
</td>
</tr>
</tbody>
</table>
</div>
</p></li><li id="cce_faq_00096__li16944798144952"><span>Modify the configuration of the nodes in the cluster.</span><p><p id="cce_faq_00096__p30410606145020">It takes about 3 to 5 minutes to configure a node.</p>
<p id="cce_faq_00096__p76013253207"><b><span class="cmdname" id="cce_faq_00096__cmdname19772145414206">curl -k https://&lt;swr-address&gt;:20202/swr/v2/domains/op_svc_servicestage/namespaces/op_svc_servicestage/repositories/default/packages/cluster-versions/versions/base/file_paths/cceadm -1 -O;chmod u+x cceadm; ./cceadm batch-config-docker --conf=./config.yaml</span></b></p>
<p id="cce_faq_00096__p584724714516">Replace <em id="cce_faq_00096__i84235269791520">&lt;swr-address&gt;</em> with the address of a software repository, which is the same as the value of <span class="parmname" id="cce_faq_00096__parmname25489348491538"><b>swrAddr</b></span> in <a href="#cce_faq_00096__table43203543121749">Table 1</a>.</p>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_faq_0083.html">Reference</a></div>
</div>
</div>