doc-exports/docs/opengauss/api-ref/opengauss_newapi_0029.html
Ru, Li Yi d97aea4dd2 opengauss_api
Reviewed-by: Boka, Ladislav <ladislav.boka@t-systems.com>
Co-authored-by: Ru, Li Yi <liyiru7@huawei.com>
Co-committed-by: Ru, Li Yi <liyiru7@huawei.com>
2024-09-06 09:04:21 +00:00

148 lines
14 KiB
HTML

<a name="EN-US_TOPIC_0000001917130500"></a><a name="EN-US_TOPIC_0000001917130500"></a>
<h1 class="topictitle1">Switching Roles of the Primary and Standby DNs in Shards</h1>
<div id="body0000001244439514"><div class="section" id="EN-US_TOPIC_0000001917130500__section4151616151917"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001917130500__p4151121681913">This API is used to perform a primary/standby DN switchover for one or more shards. In a shard, only one standby node can be promoted to primary. Before calling this API:</p>
<ul id="EN-US_TOPIC_0000001917130500__en-us_topic_0128427213_ul12259155218373"><li id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001917290508_en-us_topic_0000001791349281_li3231171417412">Learn how to <a href="opengauss_api_0010.html">authenticate</a> this API.</li><li id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001917290508_en-us_topic_0000001791349281_li41227910453">Understand the API in <a href="opengauss_api_0012.html">Using APIs</a>.</li><li id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001917290508_en-us_topic_0000001791349281_en-us_topic_0110967248_li1991981933613">Obtain the required <a href="https://docs.otc.t-systems.com/regions-and-endpoints/index.html" target="_blank" rel="noopener noreferrer">region and endpoint</a>.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001917130500__section9151131611195"><h4 class="sectiontitle">URI</h4><ul id="EN-US_TOPIC_0000001917130500__ul1515141641919"><li id="EN-US_TOPIC_0000001917130500__li015191691916">URI format<p id="EN-US_TOPIC_0000001917130500__p5151181641913"><a name="EN-US_TOPIC_0000001917130500__li015191691916"></a><a name="li015191691916"></a>POST https://{<em id="EN-US_TOPIC_0000001917130500__i51512169193">Endpoint</em>}/v3/{project_id}/instances/{instance_id}/switch-shard</p>
</li><li id="EN-US_TOPIC_0000001917130500__li91514169197">Example<p id="EN-US_TOPIC_0000001917130500__p151528167193"><a name="EN-US_TOPIC_0000001917130500__li91514169197"></a><a name="li91514169197"></a>https://gaussdb.eu-de.otc.t-systems.com/v3/0c8243400d37468bb4aed3cc94c2911d/instances/f9b5f9b296ec6808e067in14/switch-shard</p>
</li><li id="EN-US_TOPIC_0000001917130500__li1939413220453">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001917130500__table515217162192" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0000001917130500__row1115261613196"><th align="left" class="cellrowborder" valign="top" width="22.79%" id="mcps1.3.2.2.3.1.2.4.1.1"><p id="EN-US_TOPIC_0000001917130500__p615215161190">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.880000000000003%" id="mcps1.3.2.2.3.1.2.4.1.2"><p id="EN-US_TOPIC_0000001917130500__p1415231618195">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.330000000000005%" id="mcps1.3.2.2.3.1.2.4.1.3"><p id="EN-US_TOPIC_0000001917130500__p14152916191915">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001917130500__row415215167190"><td class="cellrowborder" valign="top" width="22.79%" headers="mcps1.3.2.2.3.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001917130500__p71527164199">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20.880000000000003%" headers="mcps1.3.2.2.3.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001917130500__p915210167197">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="56.330000000000005%" headers="mcps1.3.2.2.3.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001917130500__p12152181621916">Project ID of a tenant in a region.</p>
<p id="EN-US_TOPIC_0000001917130500__p91528166191">To obtain this value, see <a href="opengauss_api_0034.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001917130500__row1015241671918"><td class="cellrowborder" valign="top" width="22.79%" headers="mcps1.3.2.2.3.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001917130500__p191529160194">instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="20.880000000000003%" headers="mcps1.3.2.2.3.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001917130500__p21521716171913">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="56.330000000000005%" headers="mcps1.3.2.2.3.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001917130500__p1915291661911">DB instance ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001917130500__section161521316161913"><h4 class="sectiontitle">Request</h4><ul id="EN-US_TOPIC_0000001917130500__ul16152616181919"><li id="EN-US_TOPIC_0000001917130500__li15152171691920">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001917130500__table335861820490" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0000001917130500__row335715183496"><th align="left" class="cellrowborder" valign="top" width="24.81%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="EN-US_TOPIC_0000001917130500__p1135716185494">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.68%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="EN-US_TOPIC_0000001917130500__p1535711814913">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.75%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="EN-US_TOPIC_0000001917130500__p153571718114914">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="36.76%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="EN-US_TOPIC_0000001917130500__p9357121824911">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001917130500__row13358618144919"><td class="cellrowborder" valign="top" width="24.81%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="EN-US_TOPIC_0000001917130500__p3357918174915">shards</p>
</td>
<td class="cellrowborder" valign="top" width="18.68%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="EN-US_TOPIC_0000001917130500__p235751894910">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="19.75%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="EN-US_TOPIC_0000001917130500__p23571518184916">Array</p>
</td>
<td class="cellrowborder" valign="top" width="36.76%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="EN-US_TOPIC_0000001917130500__p1357218154917">Nodes. You can switch standby DNs of multiple shards to primary DNs. The node information is the node IDs and component IDs of shards whose standby DNs are promoted to primary. For details, see <a href="#EN-US_TOPIC_0000001917130500__table989242214713">Table 3</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001917130500__table989242214713"></a><a name="table989242214713"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001917130500__table989242214713" frame="border" border="1" rules="all"><caption><b>Table 3 </b>shards parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0000001917130500__row2892202215713"><th align="left" class="cellrowborder" valign="top" width="24.81%" id="mcps1.3.3.2.1.2.2.5.1.1"><p id="EN-US_TOPIC_0000001917130500__p1489219224710">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.68%" id="mcps1.3.3.2.1.2.2.5.1.2"><p id="EN-US_TOPIC_0000001917130500__p68922221077">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.75%" id="mcps1.3.3.2.1.2.2.5.1.3"><p id="EN-US_TOPIC_0000001917130500__p1989262214720">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="36.76%" id="mcps1.3.3.2.1.2.2.5.1.4"><p id="EN-US_TOPIC_0000001917130500__p689214221719">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001917130500__row168935224719"><td class="cellrowborder" valign="top" width="24.81%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001917130500__p1689315226715">node_id</p>
</td>
<td class="cellrowborder" valign="top" width="18.68%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001917130500__p12893172219711">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="19.75%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001917130500__p68937221375">String</p>
</td>
<td class="cellrowborder" valign="top" width="36.76%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001917130500__p7893722877">ID of the node where the standby DN to be promoted to primary is deployed.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001917130500__row1089392218717"><td class="cellrowborder" valign="top" width="24.81%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001917130500__p1893522071">component_id</p>
</td>
<td class="cellrowborder" valign="top" width="18.68%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001917130500__p1893142216710">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="19.75%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001917130500__p148939226713">String</p>
</td>
<td class="cellrowborder" valign="top" width="36.76%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001917130500__p5893522378">ID of the standby DN to be promoted to primary. It contains up to 7 characters. It cannot be null, an empty string or spaces. Before verifying and using it, spaces are automatically filtered out. The value contains at least three types of the following: uppercase letters, lowercase letters, digits, and underscores (_). For details about how to obtain the component ID, see <a href="opengauss_newapi_0030.html">Querying the Components of a DB Instance</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001917130500__section829320308458"><h4 class="sectiontitle">Example Request</h4><div class="p" id="EN-US_TOPIC_0000001917130500__p74126015361">Switching roles of primary and standby DNs in multiple shards<pre class="screen" id="EN-US_TOPIC_0000001917130500__screen038173964516">{
"shards":[
{
"node_id":"0bc478b4d132494a8f7b804da521b4b2no14",
"component_id":"dn_6001"
},
{
"node_id":"53dee94c50574d36a0060db0a6b644f6no14",
"component_id":"dn_6004"
}
]
}</pre>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001917130500__section1415321612193"><h4 class="sectiontitle">Response</h4><ul id="EN-US_TOPIC_0000001917130500__ul815317165197"><li id="EN-US_TOPIC_0000001917130500__li15153121617194">Normal response
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001917130500__table191531116101910" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0000001917130500__row1153181621915"><th align="left" class="cellrowborder" valign="top" width="33.68%" id="mcps1.3.5.2.1.1.2.4.1.1"><p id="EN-US_TOPIC_0000001917130500__p21533164192">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.47%" id="mcps1.3.5.2.1.1.2.4.1.2"><p id="EN-US_TOPIC_0000001917130500__p111531116171918">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="32.85%" id="mcps1.3.5.2.1.1.2.4.1.3"><p id="EN-US_TOPIC_0000001917130500__p13153161651916">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001917130500__row815315165197"><td class="cellrowborder" valign="top" width="33.68%" headers="mcps1.3.5.2.1.1.2.4.1.1 "><p id="EN-US_TOPIC_0000001917130500__p19153101610191">job_id</p>
</td>
<td class="cellrowborder" valign="top" width="33.47%" headers="mcps1.3.5.2.1.1.2.4.1.2 "><p id="EN-US_TOPIC_0000001917130500__p115310166192">String</p>
</td>
<td class="cellrowborder" valign="top" width="32.85%" headers="mcps1.3.5.2.1.1.2.4.1.3 "><p id="EN-US_TOPIC_0000001917130500__p61531016151917">ID of the task for switch standby DNs of multiple shards to primary DNs.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<ul id="EN-US_TOPIC_0000001917130500__ul181531716201910"><li id="EN-US_TOPIC_0000001917130500__li191531316171918">Example normal response<pre class="codeblock" id="EN-US_TOPIC_0000001917130500__codeblock141530164191">{
"job_id": "e96bbb23-e053-4bd0-b0b7-16ad3f5d9b6d"
}</pre>
</li><li id="EN-US_TOPIC_0000001917130500__li415371611190">Abnormal response<p id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0128427213_p29415884"><a name="EN-US_TOPIC_0000001917130500__li415371611190"></a><a name="li415371611190"></a>For details, see <a href="opengauss_api_0031.html">Abnormal Request Results</a>.</p>
</li></ul>
<div class="section" id="EN-US_TOPIC_0000001917130500__section10153131691911"><h4 class="sectiontitle">Status Code</h4><ul id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_ul7858132212142"><li id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_li58581622171411">Normal<p id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_p1040982941020"><a name="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_li58581622171411"></a><a name="en-us_topic_0000001704033841_en-us_topic_0110967248_li58581622171411"></a>202</p>
</li><li id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_li11583183218149">Abnormal<p id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_p65078394148"><a name="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_li11583183218149"></a><a name="en-us_topic_0000001704033841_en-us_topic_0110967248_li11583183218149"></a>For details, see <a href="opengauss_api_0032.html">Status Codes</a>.</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001917130500__section015316161194"><h4 class="sectiontitle">Error Code</h4><p id="EN-US_TOPIC_0000001917130500__en-us_topic_0000001704033841_en-us_topic_0110967248_p19357163913406">For details, see <a href="opengauss_api_0033.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="opengauss_api_0014.html">Instance Management</a></div>
</div>
</div>