Service Instance Access
This page describes usage specific to a9s Search. It builds upon the information provided in Getting Started - Accessing a Service Instance.
Accessing an a9s Search Service Instance
In order to access an a9s Search Service Instance, the Service Instance's credentials stored in the environment variables of the application bound to it. This is further explanined in Lifecycle of a Service Instance - Obtain Credentials for Accessing a Service Instance.
The resulting environment variables for an a9s MariaDB application can be seen below:
Check credentials for a9s Search
cf env a9s-search-app
Getting env variables for app a9s-search-app in org test / space test as admin...
OK
System-Provided:
{
"VCAP_SERVICES": {
"a9s-search2": [
{
"credentials": {
"host": [
"EXAMPLE_HOST"
],
"hosts": [
"EXAMPLE_HOST"
],
"password": "EXAMPLE_USER",
"username": "EXAMPLE_PASSWORD",
"scheme": "http",
"port": 9200
},
"label": "a9s-search2",
"name": "my-search-service",
"plan": "search-cluster-small",
"tags": [
"searchengine"
]
}
]
}
}
...
The host, username and password values can be used to connect to a database with an OpenSearch client.
Create a Tunnel to The Service
With the cf ssh
command a ssh forward tunnel to the management dashboard can be created.
Use port 9200 to connect to the a9s Search Instance.
$ cf ssh a9s-search-app -L 9200:d67901c.service.dc1.a9svs:9200
vcap@956aaf4e-6da9-4f69-4b1d-8e631a403312:~$
When the ssh tunnel is open you can access the instance over the address localhost:9200
.
Don't forget to close the session with exit
.