forked from docs/doc-exports
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>
196 lines
32 KiB
HTML
196 lines
32 KiB
HTML
<a name="mrs_01_0442"></a><a name="mrs_01_0442"></a>
|
|
|
|
<h1 class="topictitle1">Using Hive from Scratch</h1>
|
|
<div id="body8662426"><p id="mrs_01_0442__en-us_topic_0000001219230755_p117571659182510">Hive is a data warehouse framework built on Hadoop. It maps structured data files to a database table and provides SQL-like functions to analyze and process data. It also allows you to quickly perform simple MapReduce statistics using SQL-like statements without the need of developing a specific MapReduce application. It is suitable for statistical analysis of data warehouses.</p>
|
|
<div class="section" id="mrs_01_0442__en-us_topic_0000001219230755_section316983143915"><h4 class="sectiontitle">Background</h4><p id="mrs_01_0442__en-us_topic_0000001219230755_aa6bb651d9fdc48249b2e258e8dd36987">Suppose a user develops an application to manage users who use service A in an enterprise. The procedure of operating service A on the Hive client is as follows:</p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p1571519492538"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b1113472918172">Operations on common tables</strong>:</p>
|
|
<ul id="mrs_01_0442__en-us_topic_0000001219230755_ufb6be56b34b24b42b414a82f147e9483"><li id="mrs_01_0442__en-us_topic_0000001219230755_le7f87bd280e6448fb638db9a748aefdf">Create the <strong id="mrs_01_0442__en-us_topic_0000001219230755_b1433713308170">user_info</strong> table.</li><li id="mrs_01_0442__en-us_topic_0000001219230755_lee40db3e7049462584b60ba65919ab05">Add users' educational backgrounds and professional titles to the table.</li><li id="mrs_01_0442__en-us_topic_0000001219230755_l4f59951cb9de4db4a0920a457495ebba">Query user names and addresses by user ID.</li><li id="mrs_01_0442__en-us_topic_0000001219230755_l0caa82526a5a4227909b3c75691ae936">Delete the user information table after service A ends.</li></ul>
|
|
|
|
<div class="tablenoborder"><a name="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_table27353390"></a><a name="en-us_topic_0000001219230755_en-us_topic_0037446806_table27353390"></a><table cellpadding="4" cellspacing="0" summary="" id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_table27353390" frame="border" border="1" rules="all"><caption><b>Table 1 </b>User information</caption><thead align="left"><tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row32789387"><th align="left" class="cellrowborder" valign="top" width="19.998000199980005%" id="mcps1.3.2.5.2.6.1.1"><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p38694667"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b1249433513170">ID</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.678432156784321%" id="mcps1.3.2.5.2.6.1.2"><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p22689808"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b1048316383176">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="17.558244175582445%" id="mcps1.3.2.5.2.6.1.3"><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p32089967"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b73261939111719">Gender</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.2984701529847%" id="mcps1.3.2.5.2.6.1.4"><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p39701876"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b157564402174">Age</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="31.46685331466853%" id="mcps1.3.2.5.2.6.1.5"><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p18747312"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b205791941161712">Address</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row43691456"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p49347015">12005000201</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p37685299">A</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p32610412">Male</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p24197721">19</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p13858403">City A</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row57616766"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p36446461">12005000202</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p66482253">B</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p16353430">Female</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p49559423">23</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p54890288">City B</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row24250547"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p18137316">12005000203</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p59836530">C</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p14920772">Male</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p623043">26</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p50466518">City C</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row51545483"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p14434584">12005000204</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p28350637">D</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p14700275">Male</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p49871633">18</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p13070512">City D</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row50525752"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p66054074">12005000205</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p48779793">E</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p58849189">Female</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p2055005">21</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p32237730">City E</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row21704116"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p13202999">12005000206</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p62809978">F</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p54443429">Male</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p47841633">32</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p49967061">City F</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row47050372"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p52983808">12005000207</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p63830089">G</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p2854726">Female</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p29906272">29</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p6488958">City G</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row58400626"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p32830290">12005000208</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p42007851">H</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p47192740">Female</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p64515557">30</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p58377623">City H</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row55636561"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p10267631">12005000209</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p26371793">I</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p55740512">Male</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p18687619">26</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p37302179">City I</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_row175293"><td class="cellrowborder" valign="top" width="19.998000199980005%" headers="mcps1.3.2.5.2.6.1.1 "><p id="mrs_01_0442__en-us_topic_0000001219230755_p20275141018126">12005000210</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.678432156784321%" headers="mcps1.3.2.5.2.6.1.2 "><p id="mrs_01_0442__en-us_topic_0000001219230755_p7273191071210">J</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.558244175582445%" headers="mcps1.3.2.5.2.6.1.3 "><p id="mrs_01_0442__en-us_topic_0000001219230755_p12194165416015">Female</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.2984701529847%" headers="mcps1.3.2.5.2.6.1.4 "><p id="mrs_01_0442__en-us_topic_0000001219230755_p127221061217">25</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.46685331466853%" headers="mcps1.3.2.5.2.6.1.5 "><p id="mrs_01_0442__en-us_topic_0000001219230755_p2270910101219">City J</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="mrs_01_0442__en-us_topic_0000001219230755_section16880721113918"><h4 class="sectiontitle">Procedure</h4><ol id="mrs_01_0442__en-us_topic_0000001219230755_ol11471534103911"><li id="mrs_01_0442__en-us_topic_0000001219230755_l6b58a848ef0f4fe6a361d4ef0ac39fb8"><a name="mrs_01_0442__en-us_topic_0000001219230755_l6b58a848ef0f4fe6a361d4ef0ac39fb8"></a><a name="en-us_topic_0000001219230755_l6b58a848ef0f4fe6a361d4ef0ac39fb8"></a><span>Download the client configuration file.</span><p><ol type="a" id="mrs_01_0442__ol1735014143384"><li id="mrs_01_0442__li13277122814388">Log in to FusionInsight Manager. For details, see <a href="mrs_01_2124.html">Accessing FusionInsight Manager</a>.</li><li id="mrs_01_0442__li976173519384">Choose <strong id="mrs_01_0442__b1429112893820">Cluster</strong> > <em id="mrs_01_0442__i1329122873816">Name of the desired cluster</em> > <strong id="mrs_01_0442__b3291182873810">Dashboard</strong> > <strong id="mrs_01_0442__b52912028163814">More</strong> > <strong id="mrs_01_0442__b529192818385">Download Client</strong>.</li><li id="mrs_01_0442__li453803913812">Download the cluster client.</li><li id="mrs_01_0442__li1745312493382">Set <span class="parmname" id="mrs_01_0442__parmname182474457386"><b>Select Client Type</b></span> to <span class="parmvalue" id="mrs_01_0442__parmvalue142471453382"><b>Configuration Files Only </b></span>, select a platform type, and click <span class="uicontrol" id="mrs_01_0442__uicontrol2247164553814"><b>OK</b></span> to generate the client configuration file which is then saved in the <strong id="mrs_01_0442__b19247154520384">/tmp/FusionInsight-Client/</strong> directory on the active management node by default.</li></ol>
|
|
</p></li><li id="mrs_01_0442__en-us_topic_0000001219230755_li595112919519"><span>Log in to the active management node of Manager.</span><p><ol type="a" id="mrs_01_0442__ol2071539103914"><li id="mrs_01_0442__li179946158399">Log in to any node where Manager is deployed as user <strong id="mrs_01_0442__en-us_topic_0000001219230755_b098755910363">root</strong>.</li><li id="mrs_01_0442__li71591617397">Run the following command to identify the active and standby nodes:<p id="mrs_01_0442__p014181618398"><a name="mrs_01_0442__li71591617397"></a><a name="li71591617397"></a><strong id="mrs_01_0442__b2014616203912">sh ${BIGDATA_HOME}/om-server/om/sbin/status-oms.sh</strong></p>
|
|
<p id="mrs_01_0442__p151571683917">In the command output, the value of <strong id="mrs_01_0442__b31481673916">HAActive</strong> for the active management node is <strong id="mrs_01_0442__b1214916203911">active</strong>, and that for the standby management node is <strong id="mrs_01_0442__b1315181673914">standby</strong>. In the following example, <strong id="mrs_01_0442__b31513166391">node-master1</strong> is the active management node, and <strong id="mrs_01_0442__b5151616193916">node-master2</strong> is the standby management node.</p>
|
|
<pre class="screen" id="mrs_01_0442__screen1415111613910">HAMode
|
|
double
|
|
NodeName HostName HAVersion StartTime HAActive HAAllResOK HARunPhase
|
|
192-168-0-30 node-master1 V100R001C01 2020-05-01 23:43:02 active normal Actived
|
|
192-168-0-24 node-master2 V100R001C01 2020-05-01 07:14:02 standby normal Deactived </pre>
|
|
</li><li id="mrs_01_0442__li14505182620390">Log in to the primary management node as user <strong id="mrs_01_0442__b16452192253911">root</strong> and run the following command to switch to user <strong id="mrs_01_0442__b1245252210399">omm</strong>:<p id="mrs_01_0442__p15674537143916"><strong id="mrs_01_0442__b205241326153914">sudo su - omm</strong></p>
|
|
</li></ol>
|
|
</p></li><li id="mrs_01_0442__en-us_topic_0000001219230755_li1325114150135"><span>Run the following command to go to the client installation directory:</span><p><p id="mrs_01_0442__en-us_topic_0000001219230755_p1499713212913"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b138661758142811">cd /opt/client</strong></p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p924985613282">The cluster client has been installed in advance. The following client installation directory is used as an example. Change it based on the site requirements.</p>
|
|
</p></li><li id="mrs_01_0442__en-us_topic_0000001219230755_li15639738131312"><a name="mrs_01_0442__en-us_topic_0000001219230755_li15639738131312"></a><a name="en-us_topic_0000001219230755_li15639738131312"></a><span>Run the following command to update the client configuration for the active management node.</span><p><p id="mrs_01_0442__en-us_topic_0000001219230755_p365063812136"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b9719204219357">sh refreshConfig.sh /opt/client</strong> <i><span class="varname" id="mrs_01_0442__en-us_topic_0000001219230755_varname1665143881313">Full path of the client configuration file package</span></i></p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p86531138181318">For example, run the following command:</p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p3654193818136"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b14655103818135">sh refreshConfig.sh /opt/client </strong><strong id="mrs_01_0442__en-us_topic_0000001219230755_b2054762513449">/tmp/FusionInsight-C</strong><strong id="mrs_01_0442__en-us_topic_0000001219230755_b146151621525">lient/</strong><strong id="mrs_01_0442__en-us_topic_0000001219230755_b139102545817">FusionInsight_Cluster_1_Services_Client.tar</strong></p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p9659123820139">If the following information is displayed, the configurations have been updated successfully.</p>
|
|
<pre class="screen" id="mrs_01_0442__en-us_topic_0000001219230755_screen1866023831317"> ReFresh components client config is complete.
|
|
Succeed to refresh components client config.</pre>
|
|
<div class="note" id="mrs_01_0442__en-us_topic_0000001219230755_note1971123710424"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_0442__en-us_topic_0000001219230755_p613218111518">You can refer to Method 2 in <a href="https://docs.otc.t-systems.com/en-us/usermanual/mrs/mrs_01_0089.html" target="_blank" rel="noopener noreferrer">Updating a Client</a> to perform operations in steps <a href="#mrs_01_0442__en-us_topic_0000001219230755_l6b58a848ef0f4fe6a361d4ef0ac39fb8">1</a> to <a href="#mrs_01_0442__en-us_topic_0000001219230755_li15639738131312">4</a>.</p>
|
|
</div></div>
|
|
</p></li><li id="mrs_01_0442__en-us_topic_0000001219230755_l6556791324fa484e91dc201b480e3115"><span>Use the client on a Master node.</span><p><ol type="a" id="mrs_01_0442__en-us_topic_0000001219230755_od49292eae1f845e8a383e761ce0ce2f7"><li id="mrs_01_0442__en-us_topic_0000001219230755_led80939ae6024a9ba8841d649d5132b4">On the active management node, for example, <span class="parmvalue" id="mrs_01_0442__en-us_topic_0000001219230755_pb923e7c26e0f4bffb26f1521910a2c79"><b>192-168-0-30</b></span>, run the following command to switch to the client directory, for example, <strong id="mrs_01_0442__en-us_topic_0000001219230755_b189531649195119">/opt</strong><strong id="mrs_01_0442__en-us_topic_0000001219230755_b5953114910511"></strong><strong id="mrs_01_0442__en-us_topic_0000001219230755_b89531249105119">/client</strong>.<p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p11191414462"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b1668485133617">cd /opt</strong><strong id="mrs_01_0442__en-us_topic_0000001219230755_b17686135173619">/client</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_ldf91db8293354ac4beabdf4679eb0034">Run the following command to configure environment variables:<p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p711917124619"><a name="mrs_01_0442__en-us_topic_0000001219230755_ldf91db8293354ac4beabdf4679eb0034"></a><a name="en-us_topic_0000001219230755_ldf91db8293354ac4beabdf4679eb0034"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b10953105010554">source bigdata_env</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li495913245475">If Kerberos authentication is enabled for the current cluster, run the following command to authenticate the current user:<p id="mrs_01_0442__en-us_topic_0000001219230755_aeaf76195462f4119af05c698566aba09"><a name="mrs_01_0442__en-us_topic_0000001219230755_li495913245475"></a><a name="en-us_topic_0000001219230755_li495913245475"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b09391645217">kinit</strong> <em id="mrs_01_0442__en-us_topic_0000001219230755_i16939545217">MRS cluster user</em></p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_p809043511651">Example: user <strong id="mrs_01_0442__en-us_topic_0000001219230755_b144573521725">kinit hiveuser</strong></p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p676363144715">The current user must have the permission to create Hive tables. To create a role with the permission, refer to <a href="https://docs.otc.t-systems.com/en-us/usermanual/mrs/mrs_01_0343.html" target="_blank" rel="noopener noreferrer">Creating a Role</a>. To bind the role to the current user, refer to <a href="https://docs.otc.t-systems.com/en-us/usermanual/mrs/mrs_01_0345.html" target="_blank" rel="noopener noreferrer">Creating a User</a>. If Kerberos authentication is disabled, skip this step.</p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_li8119414469">Run the client command of the Hive component directly.<p id="mrs_01_0442__en-us_topic_0000001219230755_ae866cfe594424869bd57657b6921e1a8"><a name="mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_li8119414469"></a><a name="en-us_topic_0000001219230755_en-us_topic_0037446806_li8119414469"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b181391521567">beeline</strong></p>
|
|
</li></ol>
|
|
</p></li><li id="mrs_01_0442__en-us_topic_0000001219230755_li2015821418148"><span>Run the Hive client command to implement service A.</span><p><p id="mrs_01_0442__en-us_topic_0000001219230755_p1185185714716"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b1596817213318">Operations on internal tables</strong>:</p>
|
|
<ol type="a" id="mrs_01_0442__en-us_topic_0000001219230755_ol897653825911"><li id="mrs_01_0442__en-us_topic_0000001219230755_li12976638185912">Create the <strong id="mrs_01_0442__en-us_topic_0000001219230755_b49282232317">user_info</strong> user information table according to <a href="#mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_table27353390">Table 1</a> and add data to it.<p id="mrs_01_0442__en-us_topic_0000001219230755_p15654104164819"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b04501946124816">create table user_info(id string,name string,gender string,age int,addr string);</strong></p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p1165414144811"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b134741846124818">insert into table user_info(id,name,gender,age,addr) values("12005000201","A","Male",19,"City A");</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li10684611801">Add users' educational backgrounds and professional titles to the <strong id="mrs_01_0442__en-us_topic_0000001219230755_b76874461733">user_info</strong> table.<p id="mrs_01_0442__en-us_topic_0000001219230755_p92235520713">For example, to add educational background and title information about user 12005000201, run the following command:</p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p15797125124918"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b8436102854919">alter table user_info add columns(education string,technical string);</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li12134202514012">Query user names and addresses by user ID.<p id="mrs_01_0442__en-us_topic_0000001219230755_p192245520718"><a name="mrs_01_0442__en-us_topic_0000001219230755_li12134202514012"></a><a name="en-us_topic_0000001219230755_li12134202514012"></a>For example, to query the name and address of user 12005000201, run the following command:</p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p194503336492"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b1060310367495">select name,addr from user_info where id='12005000201';</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li83797414013">Delete the user information table.<p id="mrs_01_0442__en-us_topic_0000001219230755_p7339240174916"><a name="mrs_01_0442__en-us_topic_0000001219230755_li83797414013"></a><a name="en-us_topic_0000001219230755_li83797414013"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b629847154912">drop table user_info;</strong></p>
|
|
</li></ol>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p122385512717"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b44911519249">Operations on external partition tables</strong>:</p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p52319551076">Create an external partition table and import data.</p>
|
|
<ol type="a" id="mrs_01_0442__en-us_topic_0000001219230755_ol1218033011"><li id="mrs_01_0442__en-us_topic_0000001219230755_li16180193711">Create a path for storing external table data.<p id="mrs_01_0442__en-us_topic_0000001219230755_p11851851164916"><a name="mrs_01_0442__en-us_topic_0000001219230755_li16180193711"></a><a name="en-us_topic_0000001219230755_li16180193711"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b974413532494">hdfs dfs -mkdir /hive/user_info</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li106723516">Create a table.<p id="mrs_01_0442__en-us_topic_0000001219230755_p11899135644918"><a name="mrs_01_0442__en-us_topic_0000001219230755_li106723516"></a><a name="en-us_topic_0000001219230755_li106723516"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b17759120155020">create external table user_info(id string,name string,gender string,age int,addr string) partitioned by(year string) row format delimited fields terminated by ' ' lines terminated by '\n' stored as textfile location '/hive/user_info';</strong></p>
|
|
<div class="note" id="mrs_01_0442__en-us_topic_0000001219230755_n97342fa4140b46079eddb6a5ffc0c15e"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_0442__en-us_topic_0000001219230755_p664044323711"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b17870153516414">fields terminated</strong> indicates delimiters, for example, spaces.</p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p164171425173813"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b13995205517416">lines terminated</strong> indicates line breaks, for example, <strong id="mrs_01_0442__en-us_topic_0000001219230755_b305561240">\n</strong>.</p>
|
|
<p id="mrs_01_0442__en-us_topic_0000001219230755_p83014811213"><strong id="mrs_01_0442__en-us_topic_0000001219230755_b590111591045">/hive/user_info</strong> indicates the path of the data file.</p>
|
|
</div></div>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li166071145919">Import data.<ol class="substepthirdol" id="mrs_01_0442__en-us_topic_0000001219230755_ol208399551813"><li id="mrs_01_0442__en-us_topic_0000001219230755_li790116533110">Execute the insert statement to insert data.<p id="mrs_01_0442__en-us_topic_0000001219230755_p158281248121814"><a name="mrs_01_0442__en-us_topic_0000001219230755_li790116533110"></a><a name="en-us_topic_0000001219230755_li790116533110"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b103946535016">insert into user_info partition(year="2018") values ("12005000201","A","Male",19,"City A");</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li118197628">Run the <strong id="mrs_01_0442__en-us_topic_0000001219230755_b104308142516">load data</strong> command to import file data.<ol id="mrs_01_0442__en-us_topic_0000001219230755_ol33451271834"><li id="mrs_01_0442__en-us_topic_0000001219230755_li1796720241736">Create a file based on the data in <a href="#mrs_01_0442__en-us_topic_0000001219230755_en-us_topic_0037446806_table27353390">Table 1</a>. For example, the file name is <strong id="mrs_01_0442__en-us_topic_0000001219230755_b3239172718514">txt.log</strong>. Fields are separated by space, and the line feed characters are used as the line breaks.</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li1155464714313">Upload the file to HDFS.<p id="mrs_01_0442__en-us_topic_0000001219230755_p15839722134313"><a name="mrs_01_0442__en-us_topic_0000001219230755_li1155464714313"></a><a name="en-us_topic_0000001219230755_li1155464714313"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b6888113920436">hdfs dfs -put txt.log /tmp</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li69096114410">Load data to the table.<p id="mrs_01_0442__en-us_topic_0000001219230755_p1016010276439"><a name="mrs_01_0442__en-us_topic_0000001219230755_li69096114410"></a><a name="en-us_topic_0000001219230755_li69096114410"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b143474354320">load data inpath '/tmp/txt.log' into table user_info partition (year='2011');</strong></p>
|
|
</li></ol>
|
|
</li></ol>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li14540174717212">Query the imported data.<p id="mrs_01_0442__en-us_topic_0000001219230755_p17449531124314"><a name="mrs_01_0442__en-us_topic_0000001219230755_li14540174717212"></a><a name="en-us_topic_0000001219230755_li14540174717212"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b195591144174310">select * from user_info;</strong></p>
|
|
</li><li id="mrs_01_0442__en-us_topic_0000001219230755_li7472135717217">Delete the user information table.<p id="mrs_01_0442__en-us_topic_0000001219230755_p20368335114316"><a name="mrs_01_0442__en-us_topic_0000001219230755_li7472135717217"></a><a name="en-us_topic_0000001219230755_li7472135717217"></a><strong id="mrs_01_0442__en-us_topic_0000001219230755_b6303144674311">drop table user_info;</strong></p>
|
|
</li></ol>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_0581.html">Using Hive</a></div>
|
|
</div>
|
|
</div>
|
|
|