doc-exports/docs/dws/umn/dws_01_0037.html
luhuayi 85562e1879 DWS UMN 831.100 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: luhuayi <luhuayi@huawei.com>
Co-committed-by: luhuayi <luhuayi@huawei.com>
2024-11-13 08:55:54 +00:00

103 lines
32 KiB
HTML

<a name="EN-US_TOPIC_0000001952008269"></a><a name="EN-US_TOPIC_0000001952008269"></a>
<h1 class="topictitle1">Using the Linux gsql Client to Connect to a Cluster</h1>
<div id="body1491553271744"><p id="EN-US_TOPIC_0000001952008269__p1920218811218">This section describes how to connect to a database through an SQL client after you create a data warehouse cluster and before you use the cluster's database. GaussDB(DWS) provides the Linux gsql client that matches the cluster version for you to access the cluster through the cluster's public or private network address.</p>
<p id="EN-US_TOPIC_0000001952008269__p2999144872210">The gsql command line client provided by GaussDB(DWS) runs on Linux. Before using it to remotely connect to a GaussDB(DWS) cluster, you need to prepare a Linux server for installing and running the gsql client. If you use a public network address to access the cluster, you can install the Linux gsql client on your own Linux server. Ensure that the Linux server has a public network address. If no EIPs are configured for your GaussDB(DWS) cluster, you are advised to create a Linux ECS for convenience purposes. For more information, see <a href="#EN-US_TOPIC_0000001952008269__section634463134117">(Optional) Preparing an ECS as the gsql Client Server</a>.</p>
<div class="section" id="EN-US_TOPIC_0000001952008269__section634463134117"><a name="EN-US_TOPIC_0000001952008269__section634463134117"></a><a name="section634463134117"></a><h4 class="sectiontitle">(Optional) Preparing an ECS as the gsql Client Server</h4><p id="EN-US_TOPIC_0000001952008269__a1fc4979fde0a46d791b15db85651c8fa">For details about how to create an ECS, see "Getting Started &gt; Creating an ECS" in the <i><cite id="EN-US_TOPIC_0000001952008269__cite2d98d4c4005c4eb4abd56ffc7f5a73f0193649">Elastic Cloud Server User Guide</cite></i>.</p>
<p id="EN-US_TOPIC_0000001952008269__a284cde43d22842a6bce84534f5f5687a">The created ECS must meet the following requirements:</p>
<ul id="EN-US_TOPIC_0000001952008269__u69ebe22621844dbf8a6682d3b7170534"><li id="EN-US_TOPIC_0000001952008269__lcfbb9c70ffcd4b58963a3228ee726e4d">ECS and GaussDB(DWS) clusters must belong to the same region and AZ.</li><li id="EN-US_TOPIC_0000001952008269__l596cb729ce254838948e977a4933e660">If you use the gsql client provided by GaussDB(DWS) to connect to the GaussDB(DWS) cluster, the ECS image must meet the following requirements:<p id="EN-US_TOPIC_0000001952008269__a7c6033b44d50435fb476dce2c2787d68"><a name="EN-US_TOPIC_0000001952008269__l596cb729ce254838948e977a4933e660"></a><a name="l596cb729ce254838948e977a4933e660"></a>The image's OS must be one of the following Linux OSs supported by the gsql client:</p>
<ul id="EN-US_TOPIC_0000001952008269__u47bfb95857fb4ea39910db675cdc2a9c"><li id="EN-US_TOPIC_0000001952008269__en-us_topic_0106894502_li6235573395">The <span class="parmvalue" id="EN-US_TOPIC_0000001952008269__pfa1d8f8431714e4c84455ce2905f9b32"><b>Redhat x86_64</b></span> client can be used on the following OSs:<ul id="EN-US_TOPIC_0000001952008269__u4a2625b1ed5c45c5b088aaea52f194c0"><li id="EN-US_TOPIC_0000001952008269__lbebaa016ac5c46038564c3b1cb2fa27e">RHEL 6.4~7.6</li><li id="EN-US_TOPIC_0000001952008269__l833638590358411595696cdb478ff859">CentOS 6.4~7.4</li><li id="EN-US_TOPIC_0000001952008269__lf1c0780ace1e44bbb5a5ce9b3a7a2135">EulerOS 2.3</li></ul>
</li><li id="EN-US_TOPIC_0000001952008269__l95ec18ee8f5049afa7a0b2721d86e9eb">The <span class="parmvalue" id="EN-US_TOPIC_0000001952008269__p7d8679fb94dc4114a799ea35e6c0849f"><b>SUSE x86_64</b></span> client can be used on the following OSs:<ul id="EN-US_TOPIC_0000001952008269__u4a196b6b00fd40c489ac130bfa2c014f"><li id="EN-US_TOPIC_0000001952008269__l27bd1176e9114454b3a37ea8a93b696c">SLES 11.1~11.4</li><li id="EN-US_TOPIC_0000001952008269__l362b19559d85416b8865df4071651ba4">SLES 12.0~12.3</li></ul>
</li></ul>
</li><li id="EN-US_TOPIC_0000001952008269__l6b5af89c5b3b4e9caebe7d2f2e6c72ba">If the client accesses the cluster using the private network address, ensure that the created ECS is in the same VPC as the GaussDB(DWS) cluster.<p id="EN-US_TOPIC_0000001952008269__aac9d944a897a42fd8471deadc226c860"><a name="EN-US_TOPIC_0000001952008269__l6b5af89c5b3b4e9caebe7d2f2e6c72ba"></a><a name="l6b5af89c5b3b4e9caebe7d2f2e6c72ba"></a>For details about VPC operations, see "VPC and Subnet" in the <em id="EN-US_TOPIC_0000001952008269__i177209924910913">Virtual Private Cloud User Guide</em>.</p>
</li><li id="EN-US_TOPIC_0000001952008269__lde6028a8d8e0481eb3b1e7060ba12d03">If the client accesses the cluster using the public network address, ensure that both the created ECS and GaussDB(DWS) cluster have an EIP.<p id="EN-US_TOPIC_0000001952008269__en-us_topic_0106894502_p53829101217"><a name="EN-US_TOPIC_0000001952008269__lde6028a8d8e0481eb3b1e7060ba12d03"></a><a name="lde6028a8d8e0481eb3b1e7060ba12d03"></a>When creating an ECS, set <strong id="EN-US_TOPIC_0000001952008269__b148985982410913">EIP</strong> to <strong id="EN-US_TOPIC_0000001952008269__b61646402510913">Automatically assign</strong> or <strong id="EN-US_TOPIC_0000001952008269__b48116068010913">Specify</strong>.</p>
</li><li id="EN-US_TOPIC_0000001952008269__l422854ceee734053b906bb63c566858b">The security group rules of the ECS must enable communication between the ECS and the port that the GaussDB(DWS) cluster uses to provide services.<p id="EN-US_TOPIC_0000001952008269__en-us_topic_0106894502_p125905804819"><a name="EN-US_TOPIC_0000001952008269__l422854ceee734053b906bb63c566858b"></a><a name="l422854ceee734053b906bb63c566858b"></a>For details about security group operations, see "Security Group" in the <em id="EN-US_TOPIC_0000001952008269__i38158291210913">Virtual Private Cloud User Guide</em>.</p>
<p id="EN-US_TOPIC_0000001952008269__a242579739d414bd8811604c33c696134">Ensure that the security group of the ECS contains rules meeting the following requirements. If the rules do not exist, add them to the security group:</p>
<ul id="EN-US_TOPIC_0000001952008269__u6929a8ed04d543408bb18ccd1cca7513"><li id="EN-US_TOPIC_0000001952008269__l8bab9e6b8f1b4c75b9ec93d027a07426"><strong id="EN-US_TOPIC_0000001952008269__b70596180910913">Transfer Direction</strong>: <strong id="EN-US_TOPIC_0000001952008269__b130279720310913">Outbound</strong></li><li id="EN-US_TOPIC_0000001952008269__l52035b45e5e24435bc9648c5dc367947">Protocol: The protocol must contain TCP. For example, <strong id="EN-US_TOPIC_0000001952008269__b160913332574453">TCP</strong> or <strong id="EN-US_TOPIC_0000001952008269__b30394156174453">All</strong>.</li><li id="EN-US_TOPIC_0000001952008269__l23aa50053fff4c7d8f7534764adfcd1a"><strong id="EN-US_TOPIC_0000001952008269__b1548811103116">Port</strong>: The value must contain the database port that provides services in the GaussDB(DWS) cluster. For example, set this parameter to <span class="parmvalue" id="EN-US_TOPIC_0000001952008269__parmvalue104887123111"><b>1-65535</b></span> or a specific GaussDB(DWS) database port.</li><li id="EN-US_TOPIC_0000001952008269__l65ffa8e5f62d4aa493852f71c07b0ff3">Destination: The IP address set here must contain the IP address of the GaussDB(DWS) cluster to be connected. <strong id="EN-US_TOPIC_0000001952008269__b2448684868238">0.0.0.0/0</strong> indicates any IP address.</li></ul>
</li><li id="EN-US_TOPIC_0000001952008269__la6857698db6042f3af997f5295f8708c">The security group rules of the data warehouse cluster must ensure that GaussDB(DWS) can receive network access requests from clients.<div class="p" id="EN-US_TOPIC_0000001952008269__a2c98025d6e3a43e7b32ac1c45bc8b893"><a name="EN-US_TOPIC_0000001952008269__la6857698db6042f3af997f5295f8708c"></a><a name="la6857698db6042f3af997f5295f8708c"></a>Ensure that the cluster's security group contains rules meeting the following requirements. If the rules do not exist, add them to the security group:<ul id="EN-US_TOPIC_0000001952008269__u8125e2b73836408baa4608e7432824f0"><li id="EN-US_TOPIC_0000001952008269__l1d70171790064baead302475d653e586"><strong id="EN-US_TOPIC_0000001952008269__b17954121043115">Transfer Direction</strong>: <strong id="EN-US_TOPIC_0000001952008269__b1495414109313">Inbound</strong></li><li id="EN-US_TOPIC_0000001952008269__l8f5ab2617314409fba693be491171205"><strong id="EN-US_TOPIC_0000001952008269__b1659639173219">Protocol</strong>: The protocol must contain TCP. For example, <strong id="EN-US_TOPIC_0000001952008269__b74168606474453">TCP</strong> or <strong id="EN-US_TOPIC_0000001952008269__b32960344974453">All</strong>.</li><li id="EN-US_TOPIC_0000001952008269__la873968a1e6b4a13bfead9e1300976c3"><strong id="EN-US_TOPIC_0000001952008269__b1294164243210">Port</strong>: Set this parameter to the servicing database port of the GaussDB(DWS) cluster. Example: 8000.</li><li id="EN-US_TOPIC_0000001952008269__l34359675f5074df280454d735f8ada97">Source IP Address: The IP address set here must contain the IP address of the GaussDB(DWS) client host. Example: 192.168.0.10/32.</li></ul>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001952008269__section2664278815443"><h4 class="sectiontitle">Downloading the Linux gsql Client and Connecting to a Cluster</h4><ol id="EN-US_TOPIC_0000001952008269__ol3845850015443"><li id="EN-US_TOPIC_0000001952008269__li57820116171210"><span>Download the Linux gsql client by referring to <a href="dws_01_0031.html">Downloading the Client</a>, and use an SSH file transfer tool (such as WinSCP) to upload the client to a target Linux server.</span><p><p id="EN-US_TOPIC_0000001952008269__p84411556205215">You are advised to download the gsql tool that matches the cluster version. That is, use gsql 8.1.x for clusters of 8.1.0 or later, and use gsql 8.2.x for clusters of 8.2.0 or later. To download gsql 8.2.x, replace <strong id="EN-US_TOPIC_0000001952008269__b188036380462">dws_client_8.1.x_redhat_x64.zip</strong> with <strong id="EN-US_TOPIC_0000001952008269__b1669094354614">dws_client_8.2.x_redhat_x64.zip</strong>. The <strong id="EN-US_TOPIC_0000001952008269__b1188910488463">dws_client_8.1.x_redhat_x64.zip</strong> is used as an example.</p>
<p id="EN-US_TOPIC_0000001952008269__adf760149a35140c48cf09071207cd279">The user who uploads the client must have the full control permission on the target directory on the host to which the client is uploaded.</p>
<p id="EN-US_TOPIC_0000001952008269__p2754133018133">Alternatively, you can remotely manage the Linux server where the gsql is to be installed in SSH mode and run the following command in the Linux command window to download the Linux gsql client:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen0169162716481"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">wget</span><span class="w"> </span><span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">obs</span><span class="p">.</span><span class="n">otc</span><span class="p">.</span><span class="n">t</span><span class="o">-</span><span class="n">systems</span><span class="p">.</span><span class="n">com</span><span class="o">/</span><span class="n">dws</span><span class="o">/</span><span class="n">download</span><span class="o">/</span><span class="n">dws_client_8</span><span class="p">.</span><span class="mi">1</span><span class="p">.</span><span class="n">x_redhat_x64</span><span class="p">.</span><span class="n">zip</span><span class="w"> </span><span class="c1">--no-check-certificate</span>
</pre></div></td></tr></table></div>
</div>
</p></li><li id="EN-US_TOPIC_0000001952008269__li14921556171524"><span>Use the SSH tool to remotely manage the host where the client is installed.</span><p><p id="EN-US_TOPIC_0000001952008269__en-us_topic_0106888034_p141041143523">For details about how to log in to an ECS, see "ECSs&gt; Logging In to a Linux ECS &gt; Login Using an SSH Password" in the <i><cite id="EN-US_TOPIC_0000001952008269__cd7370d9c4ec64f37aeceb04df55fd347">Elastic Cloud Server User Guide</cite></i>.</p>
</p></li><li id="EN-US_TOPIC_0000001952008269__li143598191920"><span>(Optional) <span id="EN-US_TOPIC_0000001952008269__text443615881913">To connect to the cluster in SSL mode</span>, configure SSL authentication parameters on the host where the client is installed. For details, see <a href="dws_01_0038.html">Establishing Secure TCP/IP Connections in SSL Mode</a>.</span><p><div class="note" id="EN-US_TOPIC_0000001952008269__note04362085193"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001952008269__p943638171915">The SSL connection mode is more secure than the non-SSL mode. You are advised to connect the client to the cluster in SSL mode.</p>
</div></div>
</p></li><li id="EN-US_TOPIC_0000001952008269__li28159407171547"><span>Run the following commands to decompress the client:</span><p><pre class="screen" id="EN-US_TOPIC_0000001952008269__screen173918175523">cd &lt;<em id="EN-US_TOPIC_0000001952008269__i3290164118364">Path for saving the client</em>&gt;
unzip <em id="EN-US_TOPIC_0000001952008269__i10517201512535">dws_client_8.1.x_redhat_x64.zip</em></pre>
<p id="EN-US_TOPIC_0000001952008269__p14308192714355">In the preceding commands:</p>
<ul id="EN-US_TOPIC_0000001952008269__ul18555114323517"><li id="EN-US_TOPIC_0000001952008269__li155410439357">&lt;<em id="EN-US_TOPIC_0000001952008269__i953114942312">Path_for_storing_the_client</em>&gt;: Replace it with the actual path.</li><li id="EN-US_TOPIC_0000001952008269__li9555114313356"><em id="EN-US_TOPIC_0000001952008269__i44006421337">dws_client_8.1.x_redhat_x64.zip</em>: This is the client tool package name of <span class="parmvalue" id="EN-US_TOPIC_0000001952008269__parmvalue7400184253313"><b>RedHat x86</b></span>. Replace it with the actual name.</li></ul>
</p></li><li id="EN-US_TOPIC_0000001952008269__li15256751171613"><span>Run the following command to configure the GaussDB(DWS) client:</span><p><pre class="screen" id="EN-US_TOPIC_0000001952008269__screen39549318531">source gsql_env.sh</pre>
<p id="EN-US_TOPIC_0000001952008269__acba60d877148432faf5ecdf94dd7b73e">If the following information is displayed, the gsql client is successfully configured:</p>
<pre class="screen" id="EN-US_TOPIC_0000001952008269__s8fd77cb5c040479baaab9ae3f2ea8fa5">All things done.</pre>
</p></li><li id="EN-US_TOPIC_0000001952008269__li41463031113158"><span>Connect to the database in the GaussDB(DWS) cluster using the gsql client. Replace the values of each parameter with actual values.</span><p><pre class="screen" id="EN-US_TOPIC_0000001952008269__screen14165156155416"><strong id="EN-US_TOPIC_0000001952008269__b120218142718">gsql -d </strong><em id="EN-US_TOPIC_0000001952008269__i92021719274">&lt;Database_name&gt;</em><strong id="EN-US_TOPIC_0000001952008269__b162033142720"> -h </strong><em id="EN-US_TOPIC_0000001952008269__i620317114274">&lt;Cluster_address&gt;</em><strong id="EN-US_TOPIC_0000001952008269__b9203101202714"> -U </strong><em id="EN-US_TOPIC_0000001952008269__i320312182718">&lt;Database_user&gt;</em><strong id="EN-US_TOPIC_0000001952008269__b9203110270"> -p </strong><em id="EN-US_TOPIC_0000001952008269__i220341112717">&lt;Database_port&gt;</em> <strong id="EN-US_TOPIC_0000001952008269__b920321122719">-W </strong><em id="EN-US_TOPIC_0000001952008269__i120361112716">&lt;Cluster_password&gt;</em> <strong id="EN-US_TOPIC_0000001952008269__b22030114274">-r</strong></pre>
<p id="EN-US_TOPIC_0000001952008269__p6670175610390">The parameters are described as follows:</p>
<ul id="EN-US_TOPIC_0000001952008269__ul6532192614405"><li id="EN-US_TOPIC_0000001952008269__li135361926194014"><em id="EN-US_TOPIC_0000001952008269__i43181148132517">Database_name</em>: Enter the name of the database to be connected. If you use the client to connect to the cluster for the first time, enter the default database <span class="parmvalue" id="EN-US_TOPIC_0000001952008269__parmvalue135411726164018"><b><span id="EN-US_TOPIC_0000001952008269__text6850145215424">gaussdb</span></b></span>.</li><li id="EN-US_TOPIC_0000001952008269__li112312661818"><em id="EN-US_TOPIC_0000001952008269__i094617612267">Cluster_address</em>: For details about how to obtain this address, see <a href="dws_01_0033.html">Obtaining the Cluster Connection Address</a>. If a public network address is used for connection, set this parameter to <span class="parmname" id="EN-US_TOPIC_0000001952008269__parmname846415280514"><b>Public Network Address</b></span> or <span class="parmname" id="EN-US_TOPIC_0000001952008269__parmname1946516289517"><b>Public Network Domain Name</b></span>. If a private network address is used for connection, set this parameter to <span class="parmname" id="EN-US_TOPIC_0000001952008269__parmname3465142855111"><b>Private Network Address</b></span> or <span class="parmname" id="EN-US_TOPIC_0000001952008269__parmname174655280515"><b>Private Network Domain Name</b></span>. </li><li id="EN-US_TOPIC_0000001952008269__li16543122664016"><em id="EN-US_TOPIC_0000001952008269__i87951622192618">Database_user</em>: Enter the username of the cluster's database. If you use the client to connect to the cluster for the first time, set this parameter to the default administrator configured during cluster creation, for example, <span class="parmvalue" id="EN-US_TOPIC_0000001952008269__parmvalue901316906152829"><b>dbadmin</b></span>.</li><li id="EN-US_TOPIC_0000001952008269__li10550102618400"><em id="EN-US_TOPIC_0000001952008269__i1975219309261">Database_port</em>: Enter the database port set during cluster creation.</li></ul>
<p id="EN-US_TOPIC_0000001952008269__p4649355413199">For example, run the following command to connect to the default database <strong id="EN-US_TOPIC_0000001952008269__b121216488331"><span id="EN-US_TOPIC_0000001952008269__text5121648113314">gaussdb</span></strong> in the GaussDB(DWS) cluster:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen157451922201313"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">gsql</span><span class="w"> </span><span class="o">-</span><span class="n">d</span><span class="w"> </span><span class="n">gaussdb</span><span class="w"> </span><span class="o">-</span><span class="n">h</span><span class="w"> </span><span class="mi">10</span><span class="p">.</span><span class="mi">168</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">74</span><span class="w"> </span><span class="o">-</span><span class="n">U</span><span class="w"> </span><span class="n">dbadmin</span><span class="w"> </span><span class="o">-</span><span class="n">p</span><span class="w"> </span><span class="mi">8000</span><span class="w"> </span><span class="o">-</span><span class="n">W</span><span class="w"> </span><span class="n">password</span><span class="w"> </span><span class="o">-</span><span class="n">r</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001952008269__p14596465113158">If the following information is displayed, the connection succeeded:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen64259327113158"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">gaussdb</span><span class="o">=&gt;</span>
</pre></div></td></tr></table></div>
</div>
</p></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001952008269__section41003216539"><h4 class="sectiontitle">gsql Command Reference</h4><p id="EN-US_TOPIC_0000001952008269__p94866279131">For more information about the gsql commands, see the <em id="EN-US_TOPIC_0000001952008269__i1539711813349">Data Warehouse Service (DWS) Tool Guide</em>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001952008269__section16360114045919"><h4 class="sectiontitle">(Optional) Importing TPC-DS Sample Data Using gsql</h4><p id="EN-US_TOPIC_0000001952008269__p19752111617011">GaussDB(DWS) users can import data from external sources to data warehouse clusters. This section describes how to import sample data from OBS to a data warehouse cluster and perform querying and analysis operations on the sample data. The sample data is generated based on the standard TPC-DS benchmark test.</p>
<p id="EN-US_TOPIC_0000001952008269__p7938170102720">TPC-DS is the benchmark for testing the performance of decision support. With TPC-DS test data and cases, you can simulate complex scenarios, such as big data set statistics, report generation, online query, and data mining, to better understand functions and performance of database applications.</p>
<ol id="EN-US_TOPIC_0000001952008269__ol157036501972"><li id="EN-US_TOPIC_0000001952008269__li6937618813"><span>Use the SSH remote connection tool to log in to the server where the gsql client is installed and go to the gsql directory. The <strong id="EN-US_TOPIC_0000001952008269__b137521936738">/opt</strong> directory is used as an example for storing the gsql client.</span><p><pre class="screen" id="EN-US_TOPIC_0000001952008269__screen12234194145713"><strong id="EN-US_TOPIC_0000001952008269__b82451541105710">cd /opt</strong></pre>
</p></li><li id="EN-US_TOPIC_0000001952008269__li2697125017711"><span>Switch to the specified directory and set the AK and SK for importing sample data and the OBS access address.</span><p><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen9534125810547"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">cd</span><span class="w"> </span><span class="n">sample</span>
<span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">bash</span><span class="w"> </span><span class="n">setup</span><span class="p">.</span><span class="n">sh</span><span class="w"> </span><span class="o">-</span><span class="n">ak</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Access_Key_Id</span><span class="o">&gt;</span><span class="w"> </span><span class="o">-</span><span class="n">sk</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Secret_Access_Key</span><span class="o">&gt;</span><span class="w"> </span><span class="o">-</span><span class="n">obs_location</span><span class="w"> </span><span class="n">obs</span><span class="p">.</span><span class="n">otc</span><span class="p">.</span><span class="n">t</span><span class="o">-</span><span class="n">systems</span><span class="p">.</span><span class="n">com</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001952008269__p66971501171">If the following information is displayed, the settings are successful:</p>
<pre class="screen" id="EN-US_TOPIC_0000001952008269__screen569735012718">setup successfully!</pre>
<div class="note" id="EN-US_TOPIC_0000001952008269__note1369735019715"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001952008269__p204716185300"><em id="EN-US_TOPIC_0000001952008269__i174184215373">&lt;Access_Key_Id&gt;</em> and <em id="EN-US_TOPIC_0000001952008269__i20802426373">&lt;Secret_Access_Key&gt;</em>: indicate the AK and SK, respectively. For how to obtain the AK and SK, see "Data Import" &gt; "Concurrently Importing Data from OBS" &gt; "Creating Access Keys (AK and SK)" in <em id="EN-US_TOPIC_0000001952008269__i9687446516">Data Warehouse Service (DWS) Developer Guide</em>. Then, replace the parameters in the statements with the obtained values.</p>
</div></div>
</p></li><li id="EN-US_TOPIC_0000001952008269__li144036111801"><span>Go back to previous directory and run the gsql environment variables.</span><p><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen18599162743510"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">cd</span><span class="w"> </span><span class="p">..</span>
<span class="k">source</span><span class="w"> </span><span class="n">gsql_env</span><span class="p">.</span><span class="n">sh</span>
<span class="n">cd</span><span class="w"> </span><span class="n">bin</span>
</pre></div></td></tr></table></div>
</div>
</p></li><li id="EN-US_TOPIC_0000001952008269__li07034507712"><span>Import the sample data to the data warehouse.</span><p><p id="EN-US_TOPIC_0000001952008269__p14375203571114">Command format:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen1354517342593"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">gsql</span><span class="w"> </span><span class="o">-</span><span class="n">d</span><span class="w"> </span><span class="o">&lt;</span><span class="k">Database</span><span class="w"> </span><span class="n">name</span><span class="o">&gt;</span><span class="w"> </span><span class="o">-</span><span class="n">h</span><span class="w"> </span><span class="o">&lt;</span><span class="k">Public</span><span class="w"> </span><span class="n">network</span><span class="w"> </span><span class="n">address</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="k">cluster</span><span class="o">&gt;</span><span class="w"> </span><span class="o">-</span><span class="n">U</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Administrator</span><span class="o">&gt;</span><span class="w"> </span><span class="o">-</span><span class="n">p</span><span class="w"> </span><span class="o">&lt;</span><span class="k">Data</span><span class="w"> </span><span class="n">warehouse</span><span class="w"> </span><span class="n">port</span><span class="w"> </span><span class="nb">number</span><span class="o">&gt;</span><span class="w"> </span><span class="o">-</span><span class="n">f</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Path</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">storing</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">sample</span><span class="w"> </span><span class="k">data</span><span class="w"> </span><span class="n">script</span><span class="o">&gt;</span><span class="w"> </span><span class="o">-</span><span class="n">r</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001952008269__p549564951117">Sample command:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen398214551593"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">gsql</span><span class="w"> </span><span class="o">-</span><span class="n">d</span><span class="w"> </span><span class="n">gaussdb</span><span class="w"> </span><span class="o">-</span><span class="n">h</span><span class="w"> </span><span class="mi">10</span><span class="p">.</span><span class="mi">168</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">74</span><span class="w"> </span><span class="o">-</span><span class="n">U</span><span class="w"> </span><span class="n">dbadmin</span><span class="w"> </span><span class="o">-</span><span class="n">p</span><span class="w"> </span><span class="mi">8000</span><span class="w"> </span><span class="o">-</span><span class="n">f</span><span class="w"> </span><span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">sample</span><span class="o">/</span><span class="n">tpcds_load_data_from_obs</span><span class="p">.</span><span class="k">sql</span><span class="w"> </span><span class="o">-</span><span class="n">r</span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001952008269__note1870365011711"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001952008269__p117032502710">In the preceding command, sample data script <span class="filepath" id="EN-US_TOPIC_0000001952008269__filepath16817115523315"><b>tpcds_load_data_from_obs.sql</b></span> is stored in the sample directory (for example, <strong id="EN-US_TOPIC_0000001952008269__b19817145513336">/opt/sample/</strong>) of the GaussDB(DWS) client.</p>
</div></div>
<p id="EN-US_TOPIC_0000001952008269__p207031150572">After you enter the administrator password and successfully connect to the database in the cluster, the system will automatically create a foreign table to associate the sample data outside the cluster. Then, the system creates a target table for saving the sample data and imports the data to the target table using the foreign table.</p>
<p id="EN-US_TOPIC_0000001952008269__p1270312509710">The time required for importing a large dataset depends on the current GaussDB(DWS) cluster specifications. Generally, the import takes about 10 to 20 minutes. If information similar to the following is displayed, the import is successful.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen15703115012718"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">Time</span><span class="p">:</span><span class="mi">1845600</span><span class="p">.</span><span class="mi">524</span><span class="w"> </span><span class="n">ms</span>
</pre></div></td></tr></table></div>
</div>
</p></li></ol><ol start="5" id="EN-US_TOPIC_0000001952008269__ol146958501712"><li id="EN-US_TOPIC_0000001952008269__li969412502719"><span>In the Linux command window, run the following commands to switch to a specific directory and query the sample data:</span><p><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001952008269__screen7422039141412"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">cd</span><span class="w"> </span><span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">sample</span><span class="o">/</span><span class="n">query_sql</span><span class="o">/</span>
<span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">bash</span><span class="w"> </span><span class="n">tpcds100x</span><span class="p">.</span><span class="n">sh</span>
</pre></div></td></tr></table></div>
</div>
</p></li><li id="EN-US_TOPIC_0000001952008269__li116951502710"><span>Enter the cluster's public network IP address, access port, database name, user who accesses the database, and password of the user as prompted.</span><p><ul id="EN-US_TOPIC_0000001952008269__ul11694115016711"><li id="EN-US_TOPIC_0000001952008269__li269445010716">The default database name is <span class="parmname" id="EN-US_TOPIC_0000001952008269__parmname1769413501973"><b><span id="EN-US_TOPIC_0000001952008269__text149310555455">gaussdb</span></b></span>.</li><li id="EN-US_TOPIC_0000001952008269__li26941502712">Use the administrator username and password configured during cluster creation as the username and password for accessing the database.</li></ul>
<p id="EN-US_TOPIC_0000001952008269__p46944501878">After the query is complete, a directory for storing the query result, such as <strong id="EN-US_TOPIC_0000001952008269__b842352706184710">query_output_20170914_072341</strong>, will be generated in the current query directory, for example, <span class="filepath" id="EN-US_TOPIC_0000001952008269__filepath494650861184645"><b>sample/query_sql/</b></span>.</p>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_01_0093.html">Using the gsql CLI Client to Connect to a Cluster</a></div>
</div>
</div>