Connecting to an OpenSearch Cluster
This topic covers the prerequisites and connection details required to connect to your OpenSearch cluster for OCI Search with OpenSearch. It also includes a walkthrough that covers the steps for some basic connection scenarios using a VM instance in the same VCN and subnet as the cluster.
Use the information provided here to enable your OpenSearch clients and custom search solutions to connect and ingest data from your cluster.
While Search with OpenSearch is applying patches to a cluster's instances or resizing the cluster, the cluster's search functionality is in read-only mode, write mode is disabled for a maintenance window. See Cluster Patching and Resize Operations for more information.
Private Endpoints
Search with OpenSearch provides access to your cluster and the OpenSearch Dashboards for your cluster over private endpoints. The service provides two ways to connect to the private endpoints for your cluster:
- Private IP: The private IP address for the private endpoint. Use the private IP if you're connecting from a VM instance within the same VCN and subnet as your cluster. You can also use the private IP when you connect from your local machine with port forwarding configured to the VM instance.
- API endpoint: The a Fully Qualified Domain Name (FQDN) provided by the service to access cluster's private endpoints. Use the API endpoint when connecting from your OpenSearch client, such as LogStash or Beats.
See Prerequisites for specific details.
With private endpoints, traffic doesn't go over the internet. The endpoints are only accessible from within your cluster's VCN. To make the API endpoint access to your OpenSearch clients, more configuration is required to make the endpoint accessible to external clients. For example, you could use API Gateway to enable access with a public IP address.
Prerequisites
Following are the list of prerequisites required to connect to your cluster
Cluster Connection Information
The cluster's connection information includes the API endpoints and IP addresses that you use to connect to and work with your cluster and the cluster's OpenSearch Dashboards. For more information, see Private Endpoints.
You can find all the connection information on the Cluster Details page in the Console.
Connections to clusters created before September 15th, 2022 require that you download a certificate. The API endpoint's domain for these clusters is
oci.oracleiaas.com
.Connections to clusters created September 15th, 2022 or later don't require the extra step of downloading a certificate. The API endpoint's domain for these clusters is oci.oraclecloud.com
.Viewing Cluster Details
Create Security Rules
You need to create security rules for the cluster's VCN to allow connections to the cluster and the cluster's OpenSearch Dashboards.
To make the data accessible from your cluster, you need to add stateful ingress security rules for TCP traffic for the following:
- OpenSearch on destination port 9200 from source 0.0.0.0/0 and any source port.
- OpenSearch Dashboards on destination port 5601 from source 0.0.0.0/0 and any source port.
You can create a security list with these rules, or you can add them to the default security list for the cluster's VCN.
Option 1: Create a Security List
Option 2: Add rules to the default security list
Create a VM Instance (Optional)
After completing the connection prerequisites, optionally you can create a VM instance to run some basic connection tests to verify that the prerequisites have been configured correctly and that you have the correct connection information. You create the VM instance in the same subnet for the VCN you created the cluster in. See one of the following topics for how to create an instance:
After the instance is created, connect to the instance from your local machine. For more information, see the following:
Test the Connection to Your Cluster
After you're connected to the VM instance from your local machine, run one of the following commands to test the connection.
For clusters where the API endpoint domain is oci.oraclecloud.com
(created on or
after September 15, 2022):
curl https://<cluster_API_endpoint>:9200
The URL passed in this command is the value specified in the API endpoint field on the Cluster Details page. See Prerequisites.
If the connection to the endpoint is successful, a response like the following is returned:
{
"name" : "opensearch-master-0",
"cluster_name" : "<cluster_name>",
"cluster_uuid" : "<cluster_UUID>",
"version" : {
"distribution" : "opensearch",
"number" : "1.2.4-SNAPSHOT",
"build_type" : "tar",
"build_hash" : "<build_hash>",
"build_date" : "2022-02-08T16:44:39.596468Z",
"build_snapshot" : true,
"lucene_version" : "8.10.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "The OpenSearch Project: https://opensearch.org/"
}
For other commands you can test, including pushing data to the cluster, and submitting search queries to the cluster, see the Search and visualize data using OCI Search Service with OpenSearch tutorial.
Test the Connection to the Cluster's OpenSearch Dashboards
To configure port forwarding to connect to OpenSearch Dashboards, follow these steps:
OpenSearch Resources
Search with OpenSearch supports open source OpenSearch APIs, OpenSearch Dashboards, plugins, and other OpenSearch features. See the following external resources for additional information about working with OpenSearch.