Yang, Tong 3f5759eed2 MRS comp-lts 2.0.38.SP20 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2023-01-19 17:08:45 +00:00

45 lines
18 KiB
HTML

<a name="mrs_01_2096"></a><a name="mrs_01_2096"></a>
<h1 class="topictitle1">Changing the ZooKeeper Storage Directory</h1>
<div id="body32001227"><div class="section" id="mrs_01_2096__en-us_topic_0000001173949506_s6c3a03fb33d647e18f89d399795d5c92"><h4 class="sectiontitle">Scenario</h4><p id="mrs_01_2096__en-us_topic_0000001173949506_aa352e842f0364b0cbf2a29e780d03bb2">When the defined storage directory of ZooKeeper is incorrect, or when the storage plan of ZooKeeper is changed, log in to FusionInsight Manager to change the storage directory of ZooKeeper to ensure ZooKeeper runs properly. The storage directory of ZooKeeper includes the local data storage directory <strong id="mrs_01_2096__en-us_topic_0000001173949506_b98319638741559">dataDir</strong>. Changing the ZooKeeper storage directory includes the following scenarios:</p>
<ul id="mrs_01_2096__en-us_topic_0000001173949506_u16cee933abb343788cda8af0e99e6099"><li id="mrs_01_2096__en-us_topic_0000001173949506_l6ac8cef38d7346ebbc4ea9d1b6d12bc8">Change the storage directory of the ZooKeeper role. In this way, the storage directories of all the ZooKeeper instances are also changed.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_ld800b6bf72294fefa0fe011cd16ee2f7">Change the storage directory of a single ZooKeeper instance. In this way, only the storage directory of this ZooKeeper instance is changed, and the storage directories of other ZooKeeper instances are not changed.</li></ul>
</div>
<div class="section" id="mrs_01_2096__en-us_topic_0000001173949506_se2db34d9b34b4d7daa1576f9908f4a7f"><h4 class="sectiontitle">Impact on the System</h4><ul id="mrs_01_2096__en-us_topic_0000001173949506_u443e4ec2633847fd9de822dcc46bcab1"><li id="mrs_01_2096__en-us_topic_0000001173949506_l82cd600cd23b496982c8ba4b24676c2a">ZooKeeper and associated services needs to be stopped and restarted during the process of changing the storage directory of ZooKeeper, and the cluster cannot provide services before restarted.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_lceac408ef0be46678f37d918cb3627aa">The ZooKeeper instance needs to stopped and restarted during the process of changing the storage directory of the instance, and the ZooKeeper instance at this node cannot provide services before restarted.</li></ul>
</div>
<div class="section" id="mrs_01_2096__en-us_topic_0000001173949506_sbd9e3e8fb4fb447ca1710ed215ea4607"><h4 class="sectiontitle">Prerequisites</h4><ul id="mrs_01_2096__en-us_topic_0000001173949506_u4bcc691321464d5d8f76a01d25bd1abc"><li id="mrs_01_2096__en-us_topic_0000001173949506_l625a4e9ef79642e4a7103ab7b30f0a0e">New disks have been prepared and installed on each data node, and the disks are formatted.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_lfdd04567c3bb41c6960760659da7b53d">New directories have been planned for storing data in the original directories.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_lf604b07718be48b993b89782e19a1a17">The system administrator account <strong id="mrs_01_2096__en-us_topic_0000001173949506_a8b22516fcd9a4255b97ce2cf22029038">admin</strong> has been prepared.</li></ul>
</div>
<div class="section" id="mrs_01_2096__en-us_topic_0000001173949506_sc2cfe2e76b974f398832a0fe20a5356f"><h4 class="sectiontitle">Procedure</h4><p id="mrs_01_2096__en-us_topic_0000001173949506_a4216ae38a690473c91ac6121e07a658f"><strong id="mrs_01_2096__en-us_topic_0000001173949506_a916cdba93caf41248e4ec398ab1c72ee">Check the environment.</strong></p>
<ol id="mrs_01_2096__en-us_topic_0000001173949506_oe68bf44f41a942299194c8517e96ce11"><li id="mrs_01_2096__en-us_topic_0000001173949506_l43c355ca9cfb47f49ad8515aaaf78fd5"><span>Log in to FusionInsight Manager, choose <strong id="mrs_01_2096__en-us_topic_0000001173949506_b103993102041559">Cluster</strong> &gt; <em id="mrs_01_2096__en-us_topic_0000001173949506_i130622447741559">Name of the desired cluster</em> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b2762657341559">Services</strong> to check whether <strong id="mrs_01_2096__en-us_topic_0000001173949506_b35196827541559">Running Status</strong> of ZooKeeper is <strong id="mrs_01_2096__en-us_topic_0000001173949506_b123205234241559">Normal</strong>.</span><p><ul class="subitemlist" id="mrs_01_2096__en-us_topic_0000001173949506_u9f6f0f2ae4b74e2cb4ffed0fb90fc6dc"><li id="mrs_01_2096__en-us_topic_0000001173949506_l04671763de0942bcb1db8d0704e558cc">If yes, go to <a href="#mrs_01_2096__en-us_topic_0000001173949506_lea936dc5deb6448ea00cd21461dc3094">3</a>.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_l949decf08a1442bdb227140d716c8d39">If no, the ZooKeeper status is unhealthy. Go to <a href="#mrs_01_2096__en-us_topic_0000001173949506_lcdb1dc70dbb84667b8f174b2567f000b">2</a>.</li></ul>
</p></li><li id="mrs_01_2096__en-us_topic_0000001173949506_lcdb1dc70dbb84667b8f174b2567f000b"><a name="mrs_01_2096__en-us_topic_0000001173949506_lcdb1dc70dbb84667b8f174b2567f000b"></a><a name="en-us_topic_0000001173949506_lcdb1dc70dbb84667b8f174b2567f000b"></a><span>Rectify the ZooKeeper fault.</span></li><li id="mrs_01_2096__en-us_topic_0000001173949506_lea936dc5deb6448ea00cd21461dc3094"><a name="mrs_01_2096__en-us_topic_0000001173949506_lea936dc5deb6448ea00cd21461dc3094"></a><a name="en-us_topic_0000001173949506_lea936dc5deb6448ea00cd21461dc3094"></a><span>Determine whether to change the storage directory of the ZooKeeper role or that of a ZooKeeper instance:</span><p><ul class="subitemlist" id="mrs_01_2096__en-us_topic_0000001173949506_uf9712fbaccc749869c18ca597720f495"><li id="mrs_01_2096__en-us_topic_0000001173949506_l53d7155f049b42cfb36fbd54cf6a34f8">To change the storage directory of the ZooKeeper role, go to <a href="#mrs_01_2096__en-us_topic_0000001173949506_li3363814122716">4</a>.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_l6a03795f29e14865a8889c4f2b024bf4">To change the storage directory of a single ZooKeeper instance, go to <a href="#mrs_01_2096__en-us_topic_0000001173949506_li51171617171416">9</a>.</li></ul>
</p></li></ol>
<p id="mrs_01_2096__en-us_topic_0000001173949506_p5951819202719"><strong id="mrs_01_2096__en-us_topic_0000001173949506_b14278920102711">Change the storage directory of the ZooKeeper role.</strong></p>
<ol start="4" id="mrs_01_2096__en-us_topic_0000001173949506_ol1337119143277"><li id="mrs_01_2096__en-us_topic_0000001173949506_li3363814122716"><a name="mrs_01_2096__en-us_topic_0000001173949506_li3363814122716"></a><a name="en-us_topic_0000001173949506_li3363814122716"></a><span>Choose <strong id="mrs_01_2096__en-us_topic_0000001173949506_b187406776841559">Cluster</strong> &gt; <em id="mrs_01_2096__en-us_topic_0000001173949506_i21873804941559">Name of the desired cluster</em> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b117330034141559">Services</strong> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b19739309241559">ZooKeeper</strong> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b115248928541559">Stop</strong> to stop the ZooKeeper service.</span></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li1336631413271"><span>Log in to each node where the ZooKeeper service is installed as user <strong id="mrs_01_2096__en-us_topic_0000001173949506_b1836381417270">root</strong> and perform the following operations:</span><p><ol class="subitemlist" type="a" id="mrs_01_2096__en-us_topic_0000001173949506_ol15366181417271"><li id="mrs_01_2096__en-us_topic_0000001173949506_li53631514132714">Create a target directory.<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p136301418272"><a name="mrs_01_2096__en-us_topic_0000001173949506_li53631514132714"></a><a name="en-us_topic_0000001173949506_li53631514132714"></a>For example, to create the target directory <strong id="mrs_01_2096__en-us_topic_0000001173949506_b154806483841559">${BIGDATA_DATA_HOME}/zookeeper2</strong>, run the following command:</p>
<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p1136314141274"><strong id="mrs_01_2096__en-us_topic_0000001173949506_b123631114112711">mkdir ${BIGDATA_DATA_HOME}/zookeeper2</strong>.</p>
</li><li id="mrs_01_2096__en-us_topic_0000001173949506_li1436331416274">Format the new disk, and mount the target directory to the new disk. For example, mount <strong id="mrs_01_2096__en-us_topic_0000001173949506_b138188774941559">${BIGDATA_DATA_HOME}/zookeeper2</strong> to the new disk.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_li1336351472712">Modify permissions on the new directory.<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p15363161402716"><a name="mrs_01_2096__en-us_topic_0000001173949506_li1336351472712"></a><a name="en-us_topic_0000001173949506_li1336351472712"></a>For example, the new directory is <strong id="mrs_01_2096__en-us_topic_0000001173949506_b169488719941559">${BIGDATA_DATA_HOME}/zookeeper2</strong>.</p>
<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p1236321418275">Run <strong id="mrs_01_2096__en-us_topic_0000001173949506_b14363191492717">chmod 700 ${BIGDATA_DATA_HOME}/zookeeper2</strong> and <strong id="mrs_01_2096__en-us_topic_0000001173949506_b3363181492714">chown omm:wheel ${BIGDATA_DATA_HOME}/zookeeper2</strong>.</p>
</li><li id="mrs_01_2096__en-us_topic_0000001173949506_li10365161413272">Run the following commands to copy the original data to the new directory:<p id="mrs_01_2096__en-us_topic_0000001173949506_p1736461492712"><a name="mrs_01_2096__en-us_topic_0000001173949506_li10365161413272"></a><a name="en-us_topic_0000001173949506_li10365161413272"></a>For example, run <strong id="mrs_01_2096__en-us_topic_0000001173949506_b153641914182713">cp -pr ${BIGDATA_DATA_HOME}/zookeeper/version-2/ ${BIGDATA_DATA_HOME}/zookeeper2/</strong></p>
<p id="mrs_01_2096__en-us_topic_0000001173949506_p1236415140279"><strong id="mrs_01_2096__en-us_topic_0000001173949506_b113640147279">cp -pr ${BIGDATA_DATA_HOME}/zookeeper/myid ${BIGDATA_DATA_HOME}/zookeeper2/</strong></p>
</li></ol>
</p></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li173661614192716"><span>On FusionInsight Manager, choose <strong id="mrs_01_2096__en-us_topic_0000001173949506_b209285580841559">Cluster</strong> &gt; <em id="mrs_01_2096__en-us_topic_0000001173949506_i94994482241559">Name of the desired cluster</em> &gt;<strong id="mrs_01_2096__en-us_topic_0000001173949506_b113587828341559"> Service</strong> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b198523472841559">ZooKeeper</strong> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b204610497641559">Configuration</strong> to go to the configuration page of the ZooKeeper service.</span><p><p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p15366151482711">Set <strong id="mrs_01_2096__en-us_topic_0000001173949506_b21283318541559">dataDir</strong> of ZooKeeper and quorumpeer to the new target directory, such as <strong id="mrs_01_2096__en-us_topic_0000001173949506_b61186707741559">${BIGDATA_DATA_HOME}/zookeeper2</strong>.</p>
</p></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li1536651420277"><span>Click <strong id="mrs_01_2096__en-us_topic_0000001173949506_b14133440741559">Save</strong>, and then click <strong id="mrs_01_2096__en-us_topic_0000001173949506_b13864552941559">OK</strong>. Restart the ZooKeeper service.</span><p><p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p1636651422720">Click <strong id="mrs_01_2096__en-us_topic_0000001173949506_b191457579041559">Finish</strong> when the system displays "Operation successful". ZooKeeper is successfully started.</p>
</p></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li15366101410278"><span>Rename the original storage directory <strong id="mrs_01_2096__en-us_topic_0000001173949506_b293563313140">${BIGDATA_DATA_HOME}/zookeeper</strong>. If the directory is a root directory that is mounted to an independent disk, remove the disk before renaming the directory and no further action is required.</span></li></ol>
<p id="mrs_01_2096__en-us_topic_0000001173949506_p12856112214148"><strong id="mrs_01_2096__en-us_topic_0000001173949506_b6369923151412">Change the storage directory of a single ZooKeeper instance.</strong></p>
<ol start="9" id="mrs_01_2096__en-us_topic_0000001173949506_ol6119317121415"><li id="mrs_01_2096__en-us_topic_0000001173949506_li51171617171416"><a name="mrs_01_2096__en-us_topic_0000001173949506_li51171617171416"></a><a name="en-us_topic_0000001173949506_li51171617171416"></a><span>Choose <strong id="mrs_01_2096__en-us_topic_0000001173949506_b60837827041559">Cluster</strong> &gt; <em id="mrs_01_2096__en-us_topic_0000001173949506_i20890132241559">Name of the desired cluster</em> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b191322102041559">Service</strong> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b32172201041559">ZooKeeper</strong> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b79261044441559">Instances</strong>. Select the ZooKeeper instance whose storage directory needs to be modified, and choose <strong id="mrs_01_2096__en-us_topic_0000001173949506_b107343523741559">More</strong> &gt; <strong id="mrs_01_2096__en-us_topic_0000001173949506_b10431271341559">Stop Instance</strong>.</span></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li8119161717145"><span>Log in to the ZooKeeper node as user <strong id="mrs_01_2096__en-us_topic_0000001173949506_b16118161781414">root</strong>, and perform the following operations:</span><p><ol class="subitemlist" type="a" id="mrs_01_2096__en-us_topic_0000001173949506_ol1119181771420"><li id="mrs_01_2096__en-us_topic_0000001173949506_li1111841791418">Create a target directory.<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p2011881721418"><a name="mrs_01_2096__en-us_topic_0000001173949506_li1111841791418"></a><a name="en-us_topic_0000001173949506_li1111841791418"></a>For example, to create the target directory <strong id="mrs_01_2096__en-us_topic_0000001173949506_b113830250741559">${BIGDATA_DATA_HOME}/zookeeper2</strong>, run the following command:</p>
<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p0118121719142"><strong id="mrs_01_2096__en-us_topic_0000001173949506_b1211815172141">mkdir ${BIGDATA_DATA_HOME}/zookeeper2</strong>.</p>
</li><li id="mrs_01_2096__en-us_topic_0000001173949506_li7118141719147">Mount the target directory to the new disk. For example, mount <strong id="mrs_01_2096__en-us_topic_0000001173949506_b28543094141559">${BIGDATA_DATA_HOME}/yarn/data2</strong> to the new disk.</li><li id="mrs_01_2096__en-us_topic_0000001173949506_li5118151711420">Modify permissions on the new directory.<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p181181617111414"><a name="mrs_01_2096__en-us_topic_0000001173949506_li5118151711420"></a><a name="en-us_topic_0000001173949506_li5118151711420"></a>For example, to modify permissions on the <strong id="mrs_01_2096__en-us_topic_0000001173949506_b6822703341559">${BIGDATA_DATA_HOME}/yarn/data2</strong> directory, run the following commands:</p>
<p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p1411891781415"><strong id="mrs_01_2096__en-us_topic_0000001173949506_b187822718541559">chmod 700 ${BIGDATA_DATA_HOME}/zookeeper2</strong> and <strong id="mrs_01_2096__en-us_topic_0000001173949506_b69382279941559">chown omm:wheel ${BIGDATA_DATA_HOME}/zookeeper2</strong></p>
</li><li id="mrs_01_2096__en-us_topic_0000001173949506_li1611951710144">Run the following commands to copy the original data to the new directory:<p id="mrs_01_2096__en-us_topic_0000001173949506_p101181417131418"><a name="mrs_01_2096__en-us_topic_0000001173949506_li1611951710144"></a><a name="en-us_topic_0000001173949506_li1611951710144"></a>For example, run <strong id="mrs_01_2096__en-us_topic_0000001173949506_b10118217141415">cp -pr ${BIGDATA_DATA_HOME}/zookeeper/version-2/ ${BIGDATA_DATA_HOME}/zookeeper2/</strong></p>
<p id="mrs_01_2096__en-us_topic_0000001173949506_p151196171145"><strong id="mrs_01_2096__en-us_topic_0000001173949506_b2118131771419">cp -pr ${BIGDATA_DATA_HOME}/zookeeper/myid ${BIGDATA_DATA_HOME}/zookeeper2/</strong></p>
</li></ol>
</p></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li7119181714141"><span>On FusionInsight Manager, click the specified ZooKeeper instance, and switch to the <strong id="mrs_01_2096__en-us_topic_0000001173949506_b27513506541559">Instance Configuration</strong> page.</span><p><p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p0119717181413">Set <strong id="mrs_01_2096__en-us_topic_0000001173949506_b184458546041559">dataDir</strong> of ZooKeeper and quorumpeer to the new target directory, such as <strong id="mrs_01_2096__en-us_topic_0000001173949506_b103563135841559">${BIGDATA_DATA_HOME}/zookeeper2</strong>.</p>
</p></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li411951771416"><span>Click <strong id="mrs_01_2096__en-us_topic_0000001173949506_b114806228541559">Save</strong>, and then click <strong id="mrs_01_2096__en-us_topic_0000001173949506_b44909757241559">OK</strong>. Restart the ZooKeeper instance.</span><p><p class="litext" id="mrs_01_2096__en-us_topic_0000001173949506_p2011911713144">Click <strong id="mrs_01_2096__en-us_topic_0000001173949506_b26460434841559">Finish</strong> when the system displays "Operation successful". The ZooKeeper instance is successfully started.</p>
</p></li><li id="mrs_01_2096__en-us_topic_0000001173949506_li17119101716149"><span>Rename the original storage directory <strong id="mrs_01_2096__en-us_topic_0000001173949506_b630262415207">${BIGDATA_DATA_HOME}/zookeeper</strong>. If the directory is a root directory that is mounted to an independent disk, remove the disk before renaming the directory and no further action is required.</span></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_2092.html">Using ZooKeeper</a></div>
</div>
</div>