forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: zhengxiu <zhengxiu@huawei.com> Co-committed-by: zhengxiu <zhengxiu@huawei.com>
81 lines
11 KiB
HTML
81 lines
11 KiB
HTML
<a name="EN-US_TOPIC_0000001945217682"></a><a name="EN-US_TOPIC_0000001945217682"></a>
|
|
|
|
<h1 class="topictitle1">Accessing an Elasticsearch Cluster Using cURL Commands</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001945217682__p128983357017">Open-source Elasticsearch provides a series of RESTful APIs. You can run cURL commands to access these APIs using tools such as Kibana and Postman. This topic describes how to use cURL commands to access an Elasticsearch cluster.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_section346464820183"><h4 class="sectiontitle">Prerequisites</h4><ul id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_ul10447145616424"><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li1044745604219">The target Elasticsearch cluster is available.</li><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li1344713562420">An ECS has been created, and it is in the same VPC and security group as the CSS cluster.<ul id="EN-US_TOPIC_0000001945217682__ul612451510168"><li id="EN-US_TOPIC_0000001945217682__li4839213171619">If they are not in the same security group, modify the ECS security group, or configure the inbound and outbound rules of the group to allow all access from the cluster. For details, see <a href="https://docs.otc.t-systems.com/en-us/usermanual/ecs/en-us_topic_0030878383.html" target="_blank" rel="noopener noreferrer">Configuring Security Group Rules</a>.</li><li id="EN-US_TOPIC_0000001945217682__li158392130165">For details about how to use an ECS, see <a href="https://docs.otc.t-systems.com/en-us/usermanual/ecs/en-us_topic_0092494193.html" target="_blank" rel="noopener noreferrer">Creating and Logging In to a Linux ECS</a>.</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_section14909125211516"><h4 class="sectiontitle">Accessing a Cluster</h4><ol id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_ol1651417167525"><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li11618134413130">Obtain the private network address of the cluster. It is used to access the cluster.<p id="EN-US_TOPIC_0000001945217682__p152184916443"><a name="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li11618134413130"></a><a name="en-us_topic_0000001961178833_li11618134413130"></a>This topic uses a private IP address as an example to describe how to access a cluster. The cluster access address varies with the network configurations used. For details, see <a href="css_01_0190.html#EN-US_TOPIC_0000001975823337__section855085010198">Network Configuration</a>.</p>
|
|
<ol type="a" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_ol1742819417471"><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_li962471018233"><span id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_ph1162461016234">Log in to the CSS management console.</span></li><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_li562441032314">In the navigation pane on the left, choose <span class="uicontrol" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_uicontrol206034223985117"><b>Clusters > Elasticsearch</b></span>.</li><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_en-us_topic_0000001961178833_li392216231538">In the cluster list, obtain the target cluster's private IP address from the <strong id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_b7217183618175">Private IP Address</strong> column. Generally, the IP address format is <em id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_i8377769238175"><host></em>:<em id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_i16969141938175"><port></em> or <em id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_i18383433328175"><host></em>:<em id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_i16522841718175"><port></em>,<em id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_i6783075698175"><host></em>:<em id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_i18005065588175"><port></em>.<p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_en-us_topic_0000001961178833_p18422185125018">If the cluster has only one node, the IP address and port number of this single node are displayed, for example, <span class="parmvalue" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_en-us_topic_0000001961178833_parmvalue1916781025515"><b>10.62.179.32:9200</b></span>. If the cluster has multiple nodes and all of them are data nodes, the IP addresses and port numbers of all these nodes are displayed; if some of them are client nodes, only the IP addresses and port numbers of these client nodes are displayed; for example, <span class="parmvalue" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000002338102386_en-us_topic_0000001961178833_parmvalue1425141583119"><b>10.62.179.32:9200,10.62.179.33:9200</b></span>.</p>
|
|
</li></ol>
|
|
</li><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li13876151991418">Run one of the following commands on the ECS to access the cluster. The access command varies according to the security mode of the cluster.<ul id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_ul48942022152318"><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li789411220236">Cluster in non-security mode<pre class="screen" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_screen12262625142419">curl "http://<host>:<port>"</pre>
|
|
</li><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li10172522142412">Cluster in security mode + HTTP<pre class="screen" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_screen921113585271">curl -u <user>:<password> "http://<host>:<port>"</pre>
|
|
</li><li id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_li1984395519251">Cluster in security mode + HTTPS<pre class="screen" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_screen7365674284">curl -u <user>:<password> -k "https://<host>:<port>"</pre>
|
|
</li></ul>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_table111741414338" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Variables</caption><thead align="left"><tr id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_row91731411337"><th align="left" class="cellrowborder" valign="top" width="23.7%" id="mcps1.3.3.2.2.2.2.3.1.1"><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p14171714153311">Variable</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="76.3%" id="mcps1.3.3.2.2.2.2.3.1.2"><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p417131412333">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_row192601805113"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p19261218155110"><host></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p42611819514">IP address of each node in the cluster. If the cluster contains multiple nodes, there will be multiple IP addresses. You can use any of them.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_row73721818175113"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p133723186514"><port></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p16372318165118">Port number for accessing a cluster node. Generally, the port number is 9200.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_row131711473319"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p4171147336"><user></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p111791417336">Username for accessing the cluster.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_row161711420338"><td class="cellrowborder" valign="top" width="23.7%" headers="mcps1.3.3.2.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p17171149336"><password></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="76.3%" headers="mcps1.3.3.2.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p11713147339">Password of the user.</p>
|
|
<p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p12911206191917">If the password contains special characters, enclose the username and password in single quotation marks, for example, <span class="parmvalue" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_parmvalue139114565204"><b>curl -u "user:password!" "http://<host>:<port>"</b></span>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p851194212514">An access example is as follows:</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_screen136219151262">curl "http://10.62.176.32:9200"</pre>
|
|
<p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p10778131918610">Information similar to the following is displayed:</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_screen15227210104616">HTTP/1.1 200 OK
|
|
content-type: application/json; charset=UTF-8
|
|
content-length: 513
|
|
|
|
{
|
|
"name" : "xxx-1",
|
|
"cluster_name" : "xxx",
|
|
"cluster_uuid" : "xxx_uuid",
|
|
"version" : {
|
|
"number" : "7.10.2",
|
|
"build_flavor" : "oss",
|
|
"build_type" : "tar",
|
|
"build_hash" : "unknown",
|
|
"build_date" : "unknown",
|
|
"build_snapshot" : true,
|
|
"lucene_version" : "8.7.0",
|
|
"minimum_wire_compatibility_version" : "6.7.0",
|
|
"minimum_index_compatibility_version" : "6.0.0-beta1"
|
|
},
|
|
"tagline" : "You Know, for Search"
|
|
}</pre>
|
|
<div class="note" id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_note117071415813"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001945217682__en-us_topic_0000001961178833_p47161416815">For more commands, see the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html?spm=a2c4g.11186623.0.0.18211315kMUlbd" target="_blank" rel="noopener noreferrer">Elasticsearch documentation</a>.</p>
|
|
</div></div>
|
|
</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="css_01_0210.html">Accessing Elasticsearch Clusters</a></div>
|
|
</div>
|
|
</div>
|
|
|