forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Wang , Deng Ke <wangdengke2@huawei.com> Co-committed-by: Wang , Deng Ke <wangdengke2@huawei.com>
41 lines
5.6 KiB
HTML
41 lines
5.6 KiB
HTML
<a name="drs_03_0128"></a><a name="drs_03_0128"></a>
|
|
|
|
<h1 class="topictitle1">Task Creation Example</h1>
|
|
<div id="body0000001073721330"><p id="drs_03_0128__en-us_topic_0172725484_en-us_topic_0121682346_p51148444524">This section describes how to create a real-time migration task by calling an API.</p>
|
|
<div class="section" id="drs_03_0128__en-us_topic_0172725484_en-us_topic_0121682346_section872994"><h4 class="sectiontitle">Involved APIs</h4><ul id="drs_03_0128__en-us_topic_0172725484_en-us_topic_0121682346_ul15147458"><li id="drs_03_0128__en-us_topic_0172725484_en-us_topic_0121682346_li2109397">API for obtaining tokens from IAM<p id="drs_03_0128__en-us_topic_0172725484_p1334211344337"><a name="drs_03_0128__en-us_topic_0172725484_en-us_topic_0121682346_li2109397"></a><a name="en-us_topic_0172725484_en-us_topic_0121682346_li2109397"></a>Obtain a token and add <strong id="drs_03_0128__b15642145419441">X-Auth-Token</strong> to the request header of API calls.</p>
|
|
</li><li id="drs_03_0128__en-us_topic_0172725484_li3491165213428">API used to create a real-time migration task.</li></ul>
|
|
</div>
|
|
<div class="section" id="drs_03_0128__section1934815117166"><h4 class="sectiontitle">Procedure</h4><ol id="drs_03_0128__en-us_topic_0172725484_ol3860183022920"><li id="drs_03_0128__en-us_topic_0172725484_li1286119305290"><span>Obtain the token by referring to <a href="drs_01_0005.html">Authentication</a>.</span></li><li id="drs_03_0128__en-us_topic_0172725484_li19821162010414"><span>Obtain the DRS endpoints.</span><p><ul id="drs_03_0128__en-us_topic_0172725484_ul1359819231122"><li id="drs_03_0128__en-us_topic_0172725484_li165991323621">Before calling this API, obtain the required <a href="https://docs.otc.t-systems.com/en-us/endpoint/index.html" target="_blank" rel="noopener noreferrer">region and endpoint</a>.</li></ul>
|
|
</p></li><li id="drs_03_0128__en-us_topic_0172725484_li149641811871"><span>Obtain the project ID of a user in a region. For details, see <a href="drs_api_0106.html">Obtaining a Project ID</a>.</span></li><li id="drs_03_0128__en-us_topic_0172725484_li8417115310290"><span>Send POST https://{<em id="drs_03_0128__i29961039105011">DRS endpoint</em>}/v3/{projectId}/jobs.</span></li><li id="drs_03_0128__en-us_topic_0172725484_li41146117301"><span>Add <strong id="drs_03_0128__b1928175085011">X-Auth-Token</strong> to the request header. The value is user token.</span></li><li id="drs_03_0128__en-us_topic_0172725484_li1319919783019"><span>Add the <strong id="drs_03_0128__b478712557503">Content-Type</strong> key to the request header. The value of <strong id="drs_03_0128__b27891755195010">Content-Type</strong> is <strong id="drs_03_0128__b6790855135014">application/json</strong>.</span></li><li class="msonormal" id="drs_03_0128__en-us_topic_0172725484_en-us_topic_0121682346_li1586314581311"><span>Specify the following parameters in the request body:</span><p><div class="note" id="drs_03_0128__en-us_topic_0172725484_note997910579171"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="drs_03_0128__en-us_topic_0172725484_p241111213123">For details about the API used for creating DB instances, see <a href="drs_03_0104.html">Creating Tasks in Batches</a>.</p>
|
|
</div></div>
|
|
<pre class="screen" id="drs_03_0128__screen110314512383">{
|
|
"bind_eip": true,//Check whether an EIP has been bound to the replication instance in the public network scenario.
|
|
"db_use_type": "migration",//The usage type. The value can be migration (real-time migration), sync (real-time synchronization), or cloudDataGuard (real-time DR). This parameter is mandatory.
|
|
""description": "",//Task description
|
|
"engine_type": "mysql",//The engine type. The value can be mysql, mongodb, or cloudDataGuard-mysql.
|
|
"is_target_readonly": true,//Specifies whether the destination instance is readable only.
|
|
"job_direction": "up",//Task direction. The value can be <strong id="drs_03_0128__b191649013522">up</strong> or <strong id="drs_03_0128__b21661107526">down</strong>.
|
|
"name": "DRS-2057",//Task name. This parameter is mandatory.
|
|
"net_type": "eip",// Network type. This parameter is mandatory and the value can be <strong id="drs_03_0128__b10843151145217">vpn</strong>, <strong id="drs_03_0128__b14844711115220">vpc</strong>, or <strong id="drs_03_0128__b20846101115218">eip</strong>.
|
|
"node_type": "high",//Specification type. This parameter is mandatory.
|
|
"source_Endpoint": {//Information body of the source database. This parameter is mandatory.
|
|
"db_type": "mysql",//The database type. The value can be mysql, mongodb, or gaussdbv5. This parameter is mandatory.
|
|
},
|
|
"target_Endpoint": {//Information body of the destination database
|
|
"db_type": "mysql",//Database type. This parameter is mandatory.
|
|
"inst_id": "63e0699063494a8a93798f38abf3247ein01",// RDS instance ID. This parameter is mandatory when the database is an RDS DB instance.
|
|
"region": "eu-de" // The region where the RDS DB instance is located. This parameter is mandatory when the database is an RDS DB instance.
|
|
},
|
|
"task_type": "FULL_INCR_TRANS" //Task mode. The value can be <strong id="drs_03_0128__b55875288521">FULL_TRANS</strong> or <strong id="drs_03_0128__b13589182819526">FULL_INCR_TRANS</strong>.
|
|
}</pre>
|
|
<p id="drs_03_0128__en-us_topic_0172725484_p137584018285">If the request fails, an error code and error information are returned. For details, see section <a href="drs_05_0004.html">Error Code</a>.</p>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="drs_03_0126.html">Getting Started</a></div>
|
|
</div>
|
|
</div>
|
|
|