Yang, Tong 6182f91ba8 MRS component operation guide_normal 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>
2022-12-09 14:55:21 +00:00

34 lines
9.7 KiB
HTML

<a name="mrs_01_0434"></a><a name="mrs_01_0434"></a>
<h1 class="topictitle1">Using a Client to Execute Query Statements</h1>
<div id="body1589421630829"><p id="mrs_01_0434__p6585634151416">You can perform an interactive query on an MRS cluster client. For clusters with Kerberos authentication enabled, users who submit topologies must belong to the <span class="parmname" id="mrs_01_0434__parmname59119599201"><b>presto</b></span> group.</p>
<p id="mrs_01_0434__p1937961181812">The Presto component of MRS 3.x does not support Kerberos authentication.</p>
<div class="section" id="mrs_01_0434__s26390c77824e48628302cd27728a109b"><h4 class="sectiontitle">Prerequisites</h4><ul id="mrs_01_0434__ul1921432134110"><li id="mrs_01_0434__li1092113326414">The password of user <span class="parmname" id="mrs_01_0434__p168d3b622bc6437291ffb132b663ee34"><b>admin</b></span> has been obtained. The password of user <span class="parmname" id="mrs_01_0434__p65ce8b7a377247cab40e868181d0cdf4"><b>admin</b></span> is specified by the user during MRS cluster creation.</li><li id="mrs_01_0434__li10921193294111">The client has been updated.</li><li id="mrs_01_0434__li137914414587">The Presto client has been manually installed for MRS 3.<em id="mrs_01_0434__i3673678154">x</em> clusters.</li></ul>
</div>
<div class="section" id="mrs_01_0434__section15757123718144"><h4 class="sectiontitle">Procedure</h4><ol id="mrs_01_0434__o1a1694aafb174694a4a0e67712a47f76"><li id="mrs_01_0434__li17987144152514"><a name="mrs_01_0434__li17987144152514"></a><a name="li17987144152514"></a><span>For clusters with Kerberos authentication enabled, log in to MRS Manager and create a role with the <strong id="mrs_01_0434__b17603701465">Hive Admin Privilege</strong> permission. For details about how to create a role, see <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>.</span></li><li id="mrs_01_0434__li9368161132311"><a name="mrs_01_0434__li9368161132311"></a><a name="li9368161132311"></a><span>Create a user that belongs to the <strong id="mrs_01_0434__b39857295519">Presto</strong> and <strong id="mrs_01_0434__b1894515535515">Hive</strong> groups, bind the role created in <a href="#mrs_01_0434__li17987144152514">1</a> to the user, and download the user authentication file. For details, see <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> and <a href="https://docs.otc.t-systems.com/en-us/usermanual/mrs/mrs_01_0352.html" target="_blank" rel="noopener noreferrer">Downloading a User Authentication File</a>.</span></li><li id="mrs_01_0434__li861292619304"><a name="mrs_01_0434__li861292619304"></a><a name="li861292619304"></a><span>Upload the downloaded<strong id="mrs_01_0434__b73161897427"> user.keytab</strong> and <strong id="mrs_01_0434__b7416201854211">krb5.conf</strong> files to the node where the MRS client resides.</span><p><div class="note" id="mrs_01_0434__note18294255302"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_0434__p53012543010">For clusters with Kerberos authentication enabled, <a href="#mrs_01_0434__li9368161132311">2</a> to <a href="#mrs_01_0434__li861292619304">3</a> must be performed. For normal clusters, start from <a href="#mrs_01_0434__l6bafa992ef354ebc8c1e16387160ae24">4</a>.</p>
</div></div>
</p></li><li id="mrs_01_0434__l6bafa992ef354ebc8c1e16387160ae24"><a name="mrs_01_0434__l6bafa992ef354ebc8c1e16387160ae24"></a><a name="l6bafa992ef354ebc8c1e16387160ae24"></a><span>Prepare a client based on service conditions and log in to the node where the client is installed.</span><p><p id="mrs_01_0434__adf68edafed604cd99d30695b463edfa5">For example, if you have updated the client on the Master2 node, log in to the Master2 node to use the client. For details, see <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>.</p>
</p></li><li id="mrs_01_0434__l6e2058aef79c4678a11786539c7d698c"><span>Run the following command to switch the user:</span><p><p id="mrs_01_0434__a1dc242a3b5a746b0b69163db94055771"><strong id="mrs_01_0434__en-us_topic_0057061151_b560210819742">sudo su - omm</strong></p>
</p></li><li id="mrs_01_0434__ldc59b65d35af40029b69d717590c5ee1"><span>Run the following command to switch to the client directory, for example, <span class="filepath" id="mrs_01_0434__f15f7cd346f484cdf97ee97e2ebfe9077"><b>/opt/client</b></span>.</span><p><p id="mrs_01_0434__a5c7abf7d609e49daa21d689801c7665d"><strong id="mrs_01_0434__en-us_topic_0057061151_b539462609946">cd /opt/client</strong></p>
</p></li><li id="mrs_01_0434__lb12ce87c6e7946bb9a848a19a34c9e35"><span>Run the following command to configure environment variables:</span><p><p id="mrs_01_0434__af0f6bc7c36064c379eed07a5509d2ba2"><strong id="mrs_01_0434__a867f14eb42d44d819707ead5ac2ca425">source bigdata_env</strong></p>
</p></li><li id="mrs_01_0434__li15202527183812"><a name="mrs_01_0434__li15202527183812"></a><a name="li15202527183812"></a><span>Connect to the Presto Server. The following provides two client connection methods based on the client type.</span><p><ul id="mrs_01_0434__ul72181133133817"><li id="mrs_01_0434__li0219533173819">Using the client provided by MRS<ul id="mrs_01_0434__ul83475453311"><li id="mrs_01_0434__li7347174173317">For clusters with Kerberos authentication disabled, run the following command to connect to the Presto Server of the cluster:<p id="mrs_01_0434__p14540123084015"><a name="mrs_01_0434__li7347174173317"></a><a name="li7347174173317"></a><strong id="mrs_01_0434__b1954513412348">presto_cli.sh</strong></p>
</li><li id="mrs_01_0434__li1518713243314">For clusters with Kerberos authentication disabled, run the following command to connect to the Presto Server of other clusters. In the command, <strong id="mrs_01_0434__b112351799193">ip</strong> indicates the floating IP address of the cluster Presto Server, which can be obtained by searching for <strong id="mrs_01_0434__b15858141210264">PRESTO_COORDINATOR_FLOAT_IP</strong> in the Presto configuration items. <strong id="mrs_01_0434__b10746141412196">port</strong> indicates the Presto Server port number and is set to <strong id="mrs_01_0434__b184461636142617">7520</strong> by default.<p id="mrs_01_0434__p184411813113213"><strong id="mrs_01_0434__b1618725711326">presto_cli.sh --server <em id="mrs_01_0434__i484010479348">http://ip:port</em></strong></p>
</li><li id="mrs_01_0434__li1769531083311">For clusters with Kerberos authentication enabled, run the following command to connect to the Presto Server of the cluster:<p id="mrs_01_0434__p1081253211408"><a name="mrs_01_0434__li1769531083311"></a><a name="li1769531083311"></a><strong id="mrs_01_0434__b71336640193445">presto_cli.sh --krb5-config-path <em id="mrs_01_0434__i63082883993445">krb5.conf file path</em> --krb5-principal <em id="mrs_01_0434__i181658847493445">User's principal</em> --krb5-keytab-path <em id="mrs_01_0434__i210189407193445">user.keytab file path</em> --user <em id="mrs_01_0434__i213195943693445">presto username</em></strong></p>
</li><li id="mrs_01_0434__li14815173517">For clusters with Kerberos authentication enabled, run the following command to connect to the Presto Server of other clusters. In the command, <strong id="mrs_01_0434__b143014297271">ip</strong> indicates the floating IP address of the cluster Presto Server, which can be obtained by searching for <strong id="mrs_01_0434__b1430132914272">PRESTO_COORDINATOR_FLOAT_IP</strong> in the Presto configuration items. <strong id="mrs_01_0434__b173011129172715">port</strong> indicates the Presto Server port number and is set to <strong id="mrs_01_0434__b18302029172720">7521</strong> by default.<p id="mrs_01_0434__p1258220100367"><strong id="mrs_01_0434__b150211304377">presto_cli.sh --krb5-config-path <em id="mrs_01_0434__i767332523716">krb5.conf file path</em> --krb5-principal <em id="mrs_01_0434__i11673102593712">User's principal</em> --krb5-keytab-path <em id="mrs_01_0434__i1673162511371">user.keytab file path</em> --server <em id="mrs_01_0434__i96738257370">https://ip:port</em> --krb5-remote-service-name <em id="mrs_01_0434__i176731725133718">Presto Server name</em></strong></p>
</li></ul>
</li><li id="mrs_01_0434__li10219143315382">Using the native client<p id="mrs_01_0434__p61779438385"><a name="mrs_01_0434__li10219143315382"></a><a name="li10219143315382"></a>The native client of Presto is <strong id="mrs_01_0434__b106201911616">Presto/presto/bin/presto</strong> in the client directory.</p>
</li></ul>
</p></li><li id="mrs_01_0434__li2161454193315"><span>Run a query statement, for example, <strong id="mrs_01_0434__b12391125213716">show catalogs</strong>.</span><p><div class="note" id="mrs_01_0434__note1831195174710"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_0434__p18311557475">For clusters with Kerberos authentication enabled, when querying <strong id="mrs_01_0434__b1524236181812">Hive Catalog</strong> data, the user who runs the Presto client must have the permission to access Hive tables and run the<strong id="mrs_01_0434__b102221019181911"> grant all on table [table_name] to group hive</strong> command in Hive beeline to grant permissions to the Hive group.</p>
</div></div>
</p></li><li id="mrs_01_0434__lbe3cdaf67f5b4cf18419fbbdeb422302"><span>After the query is complete, run the following command to exit the client:</span><p><p id="mrs_01_0434__p42756155342"><strong id="mrs_01_0434__b75761313349">quit</strong></p>
</p></li></ol>
</div>
<p id="mrs_01_0434__p8060118"></p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_0432.html">Using Presto</a></div>
</div>
</div>