Files
doc-exports/docs/obs/tool-obsutil/obs_11_0039.html
weihongmin1 a41a4e0331 OBS Util 0115 Version
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com>
Co-authored-by: weihongmin1 <weihongmin1@huawei.com>
Co-committed-by: weihongmin1 <weihongmin1@huawei.com>
2026-02-17 10:18:57 +00:00

35 lines
6.4 KiB
HTML

<a name="obs_11_0039"></a><a name="obs_11_0039"></a>
<h1 class="topictitle1">Using obsutil to Replicate Data Across Regions on the Client Side</h1>
<div id="body1608118480698"><p id="obs_11_0039__p8060118">obsutil client supports cross-region replication. You can directly replicate data from a source bucket to the destination bucket through data streams. The source bucket and destination bucket can be any two OBS buckets. Objects can be replicated between buckets in different regions under the same account or across accounts. The following procedure describes how to replicate data between buckets across accounts and regions:</p>
<ol id="obs_11_0039__ol12439123364517"><li id="obs_11_0039__li12439193315455"><span>Run the <strong id="obs_11_0039__b9292171813165">obsutil config</strong> command to configure the AK, SK, and endpoint of the source bucket account.</span><p><ul id="obs_11_0039__ul1129174841612"><li id="obs_11_0039__li62911148141616">In Windows<pre class="screen" id="obs_11_0039__screen134141504119"><span>obsutil config -interactive -crr</span></pre>
</li><li id="obs_11_0039__li2065885410165">In Linux<pre class="screen" id="obs_11_0039__screen20510125011145"><span>./obsutil config -interactive -crr</span></pre>
</li></ul>
</p></li><li id="obs_11_0039__li4731615194713"><span>Run the <strong id="obs_11_0039__b11200822102516">obsutil config</strong> command to configure the AK, SK, and endpoint of the destination bucket account.</span><p><ul id="obs_11_0039__ul1054741111178"><li id="obs_11_0039__li754713115173">In Windows<pre class="screen" id="obs_11_0039__screen162586401510"><span>obsutil config -interactive</span></pre>
</li><li id="obs_11_0039__li16535141311171">In Linux<pre class="screen" id="obs_11_0039__screen1325894101510"><span>./obsutil config -interactive</span></pre>
</li></ul>
</p></li><li id="obs_11_0039__li1934120192169"><span>Check the connectivity to ensure that the destination bucket is correctly configured.</span><p><ul id="obs_11_0039__ul173105390185"><li id="obs_11_0039__li173101239121813">In Windows<pre class="screen" id="obs_11_0039__screen18391205165">obsutil ls -s</pre>
</li><li id="obs_11_0039__li681934171911">In Linux or macOS<pre class="screen" id="obs_11_0039__screen54471715121916">./obsutil ls -s</pre>
</li></ul>
<p id="obs_11_0039__p1452915815368">Check the command output:</p>
<ul id="obs_11_0039__ul157631931518"><li id="obs_11_0039__li376181991519">If it contains "Bucket number", the configuration is correct.</li><li id="obs_11_0039__li10711119141614">If it contains "Http status [403]", the access keys are wrong.</li><li id="obs_11_0039__li19649103911919">If it contains "A connection attempt failed", OBS cannot be connected. Then, check the network condition.</li><li id="obs_11_0039__li13706544314">If it contains "Error: cloud_url [url] is not in well format", the domain name to be accessed is incorrect. Check the domain name in the configuration file.</li></ul>
<div class="note" id="obs_11_0039__note139810916178"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_11_0039__p143981096179">If the command output contains "Http status [403]", you may not have the required permissions for obtaining the bucket list. A further analysis is required to identify the root cause.</p>
</div></div>
</p></li><li id="obs_11_0039__li20602103564710"><span>Run the <strong id="obs_11_0039__b24466339255">cp</strong> command to specify that cross-region replication method is used to copy objects from the source bucket to the destination bucket.</span><p><ul id="obs_11_0039__ul9749112711720"><li id="obs_11_0039__li1474902741715">In Windows<pre class="screen" id="obs_11_0039__screen5420916185119"><span>obsutil cp obs://src-bucket obs://dst-bucket -f -r -crr</span></pre>
</li></ul>
<ul id="obs_11_0039__ul175021299179"><li id="obs_11_0039__li185021129191719">In Linux<pre class="screen" id="obs_11_0039__screen1457461121612"><span>./obsutil cp obs://src-bucket obs://dst-bucket -f -r -crr</span></pre>
</li></ul>
</p></li></ol>
<div class="note" id="obs_11_0039__note1647002295216"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="obs_11_0039__ul63975143532"><li id="obs_11_0039__li4132467561">To use the cross-region replication function, you need to specify the <strong id="obs_11_0039__b183703536508">-crr</strong> parameter. If this parameter is specified, update the configuration of the client-side cross-region replication in the configuration file. For details, see <a href="obs_11_0023.html">Updating a Configuration File</a>.</li><li id="obs_11_0039__li17823184795519">The configurations of the source bucket and destination bucket are respectively <strong id="obs_11_0039__b1028317394322">akCrr/skCrr/tokenCrr/endpointCrr</strong> and <strong id="obs_11_0039__b19283203973211">ak/sk/token/endpoint</strong> in the configuration file.</li><li id="obs_11_0039__li3320747105414">The preceding procedure is also applicable to the situation when the source and destination buckets belong to the same account.</li></ul>
</div></div>
<div class="caution" id="obs_11_0039__note61815386279"><span class="cautiontitle"><img src="public_sys-resources/caution_3.0-en-us.png"> </span><div class="cautionbody"><p id="obs_11_0039__p1183389276">When the <strong id="obs_11_0039__b139671715066">-crr</strong> parameter is used, the source object's standard metadata, including <strong id="obs_11_0039__b39182056782">Cache-Control</strong>, <strong id="obs_11_0039__b1133220588814">Expires</strong>, <strong id="obs_11_0039__b11454165914813">Content-Encoding</strong>, <strong id="obs_11_0039__b1362640599">Content-Disposition</strong>, <strong id="obs_11_0039__b17359128912">Content-Type</strong>, and <strong id="obs_11_0039__b48191976916">Content-Language</strong>, will not be copied.</p>
<p id="obs_11_0039__p134833151078">When the <strong id="obs_11_0039__b1667195023214">-crr</strong> parameter is used for cross-region replication, the ACL of the source object will not be copied. You can use <strong id="obs_11_0039__b826321218422">[-acl=</strong><em id="obs_11_0039__i1410218514421">xxx</em><strong id="obs_11_0039__b22154147425">]</strong> to specify the ACL for the target object. If the ACL is not specified, the object inherits the ACL of the bucket by default.</p>
</div></div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_11_0033.html">Best Practices</a></div>
</div>
</div>