Managing hosts
Warning
Yandex Managed Service for Elasticsearch is unavailable as of April 11, 2024.
You can create an OpenSearch cluster in Yandex Cloud as an alternative to Elasticsearch.
You can get a list of Elasticsearch cluster hosts and add or delete them. To learn how to move your cluster hosts to a different availability zone, see this guide.
Note
You can only add or delete hosts with the Data node role.
Getting a list of cluster hosts
- In the management console
, go to the folder page and select Managed Service for Elasticsearch. - Click the name of the cluster you need and select the Hosts tab.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To get a list of cluster hosts, run the command:
yc managed-elasticsearch host list --cluster-name <cluster_name>
You can request the cluster name with the list of clusters in the folder.
To get a list of cluster hosts, use the listHosts REST API method for the Cluster resource or the ClusterService/ListHosts gRPC API call and provide the cluster ID in the clusterId
request parameter.
You can get the cluster ID with a list of clusters in the folder.
Adding hosts to a cluster
Warning
You cannot enable public access to a host once it is created.
-
In the management console
, go to the folder page and select Managed Service for Elasticsearch. -
Click the name of the cluster you need and select the Hosts tab.
-
Click Create host.
-
Specify the host parameters:
- Availability zone.
- Subnet (if the necessary subnet is not in the list, create it).
- Select Public access if the host must be accessible from outside Yandex Cloud. You cannot change this setting after you create a host.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To add hosts to a cluster, run the command:
yc managed-elasticsearch host add \
--cluster-name <cluster_name> \
--host zone-id=<availability_zone>,`
`subnet-name=<subnet_name>,`
`assign-public-ip=<public_access>,`
`type=<host_role>
Where:
assign-public-ip
: Public access to the host,true
orfalse
.type
: Host role:datanode
ormasternode
.
You can request the cluster name with the list of clusters in the folder.
To add a host to the cluster:
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about creating this file, see Creating clusters.
For a complete list of available Managed Service for Elasticsearch cluster configuration fields, see the Terraform provider documentation
. -
Add a
host
section to the Managed Service for Elasticsearch cluster description:resource "yandex_mdb_elasticsearch_cluster" "<cluster_name>" { ... host { name = "<host_name>" zone = "<availability_zone>" type = "<host_role>" assign_public_ip = <public_access> subnet_id = "<subnet_ID>" } }
Where:
type
: Host role:DATA_NODE
orMASTER_NODE
.assign_public_ip
: Public access to the host,true
orfalse
.
-
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm updating the resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
Time limits
A Terraform provider sets the timeout for Managed Service for Elasticsearch cluster operations:
- Creating a cluster, including by restoring one from a backup: 30 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the
timeouts
block to the cluster description, for example:resource "yandex_mdb_elasticsearch_cluster" "<cluster_name>" { ... timeouts { create = "1h30m" # 1 hour 30 minutes update = "2h" # 2 hours delete = "30m" # 30 minutes } }
-
To add hosts to a cluster, use the addHosts REST API method for the Cluster resource or the ClusterService/AddHosts gRPC API call and provide the following in the request:
-
Cluster ID in the
clusterId
parameter.You can get the cluster ID with a list of clusters in the folder.
-
New host settings in one or more
hostSpecs
parameters.
Warning
If you cannot connect to the host you added, check that the cluster security group is configured correctly for the host's subnet.
Deleting hosts from a cluster
The following restrictions apply when deleting hosts:
- You cannot delete a single host with the Data node role.
- If a cluster consists of multiple hosts with the Data node role, you cannot delete the last two hosts.
- In the management console
, go to the folder page and select Managed Service for Elasticsearch. - Click the name of the cluster you need and select the Hosts tab.
- Click
in the host's row and select Delete.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To remove a host from the cluster, run:
yc managed-elasticsearch host delete <host_name> --cluster-name <cluster_name>
You can request the host name with a list of cluster hosts, and the cluster name, with a list of clusters in the folder.
To remove a host from a cluster:
-
Open the current Terraform configuration file with an infrastructure plan.
For more information about creating this file, see Creating clusters.
For a complete list of available Managed Service for Elasticsearch cluster configuration fields, see the Terraform provider documentation
. -
Delete the corresponding
host
block from the Managed Service for Elasticsearch cluster description. -
Make sure the settings are correct.
-
Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.
-
Run the command:
terraform validate
If there are errors in the configuration files, Terraform will point to them.
-
-
Confirm the deletion of resources.
-
Run the command to view planned changes:
terraform plan
If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.
-
If you are happy with the planned changes, apply them:
-
Run the command:
terraform apply
-
Confirm the update of resources.
-
Wait for the operation to complete.
-
Time limits
A Terraform provider sets the timeout for Managed Service for Elasticsearch cluster operations:
- Creating a cluster, including by restoring one from a backup: 30 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the set timeout are interrupted.
How do I change these limits?
Add the
timeouts
block to the cluster description, for example:resource "yandex_mdb_elasticsearch_cluster" "<cluster_name>" { ... timeouts { create = "1h30m" # 1 hour 30 minutes update = "2h" # 2 hours delete = "30m" # 30 minutes } }
-
To delete a host, use the deleteHosts REST API method for the Cluster resource or the ClusterService/DeleteHosts gRPC API call and provide the following in the request:
-
Cluster ID in the
clusterId
parameter.You can get the cluster ID with a list of clusters in the folder.
-
Name or array of names of hosts to delete in the
hostNames
parameter.