SearchStax Named to the 2024 Deloitte Technology Fast 500 | LEARN MORE
Feb. 19, 2018
admin
|
Doing the initial setup can easily take an entire day or more, even for experienced engineers. And once the system is set up, there is another matter of maintaining the cluster, attending to issues like OS patch upgrades, disk failures, node crashes, etc.
Fortunately, software such as SearchStax can ease the pain of setting up a cluster by leveraging modern automation and cloud technology. With SearchStax, a cluster can be setup in minutes by filling out some simple forms and pushing a button.
Point-and-click cluster creation is an amazing feat of modern computation. However, it turns out that automation techniques can be leveraged even further. By providing a provisioning API, a cluster can be set up by an automation job, requiring zero human intervention.
Why would one want to set up a cluster via an API? The primary use case for programmatic cluster creation is for integration of testing automation. While production search environments are long-lived, testing environments tend to be of an ephemeral nature: a cluster is created, tests are run, and the cluster is torn down. Of course, semi-permanent dedicated clusters can be provisioned for test environments. This has several downsides:
SearchStax provides a REST API that makes it easy to integrate cluster provisioning with an automated testing pipeline. In the next section, we walk through a typical sequence of API calls that such a job might perform.
The first step in the process is to obtain credentials from SearchStax. Given a username and password, a token is retrieved
curl -X POST \
https://app.searchstax.com/api/rest/v1/obtain-auth-token/ \
-d 'username=admin&password=s3cr3t'
{
"token": "b09c"
}
curl -X GET \
https://app.searchstax.com/api/rest/v2/account/MyAccount/deployment/ \
-H 'Authorization: Token b09c'
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"name": "mydeployment1",
"uid": "ss123456",
"application": "Solr",
"application_version": "6.6.2",
"tier": "Silver",
"http_endpoint": "https://ss123456-ap-southeast-2-aws.searchstax.com/solr/",
"status": "Running",
"provision_state": "Done",
"termination_lock": true,
"plan_type": "DedicatedDeployment",
"plan": "DN1",
"region_id": "ap-southeast-2",
"cloud_provider": "Amazon Web Services",
"cloud_provider_id": "aws",
"num_additional_app_nodes": 0,
"deployment_type": "Dedicated Node",
"num_nodes_default": 1,
"num_additional_zookeeper_nodes": 0,
"servers": [
"ss123456-1"
]
}
]
}
Now for the main event. We request a new cluster, passing parameters specifying the cluster name, the Solr version, the cloud provider, the region, whether a termination lock is enabled, and some other parameters.
curl -X POST \
https://app.searchstax.com/api/rest/v2/account/MyAccount/deployment/ \
-H 'Authorization: Token b09c' \
-d 'name=MyDeployment2&application_version=7.1.0&plan_type=DedicatedDeployment&cloud_provider_id=aws&plan=DN1®ion_id=us-west-1&termination_lock=true&application=Solr'
For a response, we receive an HTTP 201 CREATED status code
Notice that in our creation request, we set termination_lock to true. This protects against accidental deletion of the cluster. To enable deletion, we need to set the termination_lock to false.
curl -X POST \
https://app.searchstax.com/api/rest/v2/account/MyAccount/deployment/ \
-H 'Authorization: Token b09c' \
-d 'name=MyDeployment2&application_version=7.1.0&plan_type=DedicatedDeployment&cloud_provider_id=aws&plan=DN1®ion_id=us-west-1&termination_lock=true&application=Solr'
For the response, we receive an HTTP 200 OK status code.
Once we are through using the cluster, we will want to tear it down using the Delete API. This can be done as follows:
curl -X DELETE \
https://app.searchstax.com/api/rest/v2/account/VicRoads2/deployment/ss677906/ \
-H 'Authorization: Token b09c'
For the response, we receive an HTTP 200 OK status code.
The Stack is delivered bi-monthly with industry trends, insights, products and more
Copyrights © SearchStax Inc.2014-2024. All Rights Reserved.
SearchStax Site Search solution is engineered to give marketers the agility they need to optimize site search outcomes. Get full visibility into search analytics and make real-time changes with one click.
close
SearchStax Managed Search service automates, manages and scales hosted Solr infrastructure in public or private clouds. Free up developers for value-added tasks and reduce costs with fewer incidents.
close
close