For security purposes, Alibaba Cloud Elasticsearch instances are isolated from each other by default. To use the cross-cluster search feature, you must first connect the networks of the two instances. This topic describes how to configure network connections between instances to enable cross-cluster search.
Prerequisites
Create the source and destination Elasticsearch instances that you want to connect. The instances must meet the following conditions. For more information, see Create an Alibaba Cloud Elasticsearch instance.
They belong to the same Alibaba Cloud account.
They are the same version.
ImportantNetwork intercommunication is not supported for Alibaba Cloud Elasticsearch V8.x, V7.16, or some V7.10 and V6.7 instances. For availability, refer to the console.
They are deployed in the same virtual private cloud (VPC).
They are both single-zone instances or both multi-zone instances.
They are in the same network architecture.
Instances that use the cloud-native control (v3) architecture do not support operations such as cross-cluster reindex, cross-cluster search, or cross-cluster replication with instances that use the basic control (v2) architecture. To check the deployment mode, you can view the basic information of the instance.
For the China (Zhangjiakou) region and regions outside China, the time required for network architecture adjustment is uncertain. You must submit a ticket to Alibaba Cloud Elasticsearch technical support to verify that the networks can be interconnected.
Procedure
Step 1: Configure network intercommunication between instances
Log on to the Alibaba Cloud Elasticsearch console.
In the left-side navigation pane, click Elasticsearch Clusters.
Navigate to the desired cluster.
In the top navigation bar, select the resource group to which the cluster belongs and the region where the cluster resides.
On the Elasticsearch Clusters page, find the cluster and click its ID.
In the navigation pane on the left, choose .
In the Cluster Network Settings section, click Modify to the right of Configure Instance Network Intercommunication.
On the Modify Configuration page, click Add Instance.
In the Add Instance dialog box, select the remote instance to which you want to connect.
ImportantA Resource Access Management (RAM) user needs the ListInstance permission to retrieve all instances under the corresponding Alibaba Cloud account. For more information, see Authorize resources for Elasticsearch.
After you configure network intercommunication between instances, the current instance is also visible on the Configure Instance Network Intercommunication page of the remote instance. The network connection is bi-directional. For example, if you configure a network connection from instance A to instance B, the network of instance B is also connected to instance A.
Click Confirm.
After the instance is added, you can view the list of instances connected to the current instance on the Modify Configuration page.
NoteIf you no longer need the connected instance, you can click Remove to remove it.
Step 2: Configure cross-cluster search
After you configure network intercommunication between instances, you must configure cross-cluster search on the current instance to search for data in the remote instance.
In the remote Elasticsearch instance, prepare test data.
NoteThis step helps you verify the cross-cluster search feature. If your remote instance already contains data for testing, you can skip this step.
Log on to the Kibana console of the remote Elasticsearch instance and go to the Kibana homepage.
For more information about how to log on to the Kibana console, see Log on to the Kibana console.
NoteIn this example, an Elasticsearch V6.7.0 cluster is used. Operations on clusters of other versions may differ. The actual operations in the console prevail.
In the navigation pane on the left, click Dev Tools.
On the Console page, run the following commands to create an index and a document, and then insert data into the remote instance.
The following commands are provided as examples:
Create an index.
PUT /twitter { "settings" : { "index" : { "number_of_shards" : 3, "number_of_replicas" : 2 } } }Create a document and insert data.
POST twitter/_doc/ { "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elasticsearch" }
In the current Elasticsearch instance, configure cross-cluster search and verify that the configuration is successful.
Follow the instructions in Step 1 to log on to the Kibana console of the current Elasticsearch instance. Then, run the following command to configure cross-cluster search in the current instance.
The following example shows the configuration for Elasticsearch 6.7. The configuration for other versions is similar. For more information, see Cross-cluster search for Elasticsearch 7.x, Cross-cluster search for Elasticsearch 6.3, and Cross-cluster search for Elasticsearch 5.5.
The following example shows how to configure cross-cluster search using node IP addresses:
PUT _cluster/settings { "persistent": { "cluster": { "remote": { "cluster_one": { "seeds": [ "10.8.xx.xx:9300", "10.8.xx.xx:9300", "10.8.xx.xx:9300" ] } } } } }You can obtain the node IP addresses from the Node Visualization section on the Basic Information page of the instance. For more information, see View the cluster status and node information.
ImportantYou cannot use domain names to configure cross-cluster search.
If you configure cross-cluster search on the current Elasticsearch instance using the node IP addresses of the remote instance, you can query the index data of the remote instance only from the current instance. You cannot run similar commands on the remote instance to perform a reverse search. To enable reverse search, you must configure the node IP addresses of the current instance on the remote instance.
Run the following command to verify that cross-cluster search is configured.
POST /cluster_one:twitter/_doc/_search { "query": { "match_all": {} } }If the verification is successful, the following result is returned.
{ "took" : 78, "timed_out" : false, "_shards" : { "total" : 3, "successful" : 3, "skipped" : 0, "failed" : 0 }, "_clusters" : { "total" : 1, "successful" : 1, "skipped" : 0 }, "hits" : { "total" : 1, "max_score" : 1.0, "hits" : [ { "_index" : "cluster_one:twitter", "_type" : "_doc", "_id" : "qudxxxxxxxxxx_7ie6J", "_score" : 1.0, "_source" : { "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elasticsearch" } } ] } }