New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to Connect to localstack's OpenSearch with the Endpoint provided #5723
Comments
Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our developer guide. |
Hi @ByteProgramming! Does this mean that you can successfully create the index with the Could you maybe elaborate a bit on what kind of client framework you are using there and what you are trying to accomplish? |
@alexrashed Hi Alex, What client: |
Okay, seems like the issue is the DNS resolving of the created endpoint ( However, there might be a workaround which could work for you.
This way you would end up with a
EDIT: Added endpoint strategy to docker-compose example (see comment below). |
I can see in logs for domain creation: Moreover, i see these as well:
So cluster is runnning fine. For OPENSEARCH_ENDPOINT_STRATEGY=path, endpoint should be same or different? Error:
|
Hi again!
Unfortunately I forgot to add the endpoint strategy in the docker-compse example above. I edited the example in my previous comment. |
HI, Meanwhile, i will try by changing the client to use the original endpoint but i would like to know: if this is the only way it can be resolved for community edition? |
By that you mean that your client does not support a URL path?
Unfortunately this won't be possible because the endpoint strategy
No, there's something else you can try. The next option would be to use the endpoint strategy |
@alexrashed As given in doc, for index creation we should try like this: As i have pointed now to "port", i have endpoint as "http://localhost:4510", I got issue: is creation of index i am doing it correctly? |
Actually, it seems like the RestHighLevelClient from ElasticSearch does support setting a URL path prefix: Please be aware that the latest versions of the elasticsearch clients might not work with OpenSearch (Elastic and AWS had a little dispute there). I don't know if that's the case for the client you are using though. |
Looks like you've been able to resolve your issues. I'm closing this one for now. |
No. I am not able to communicate with the approaches given. |
Could you please provide some more information?
|
HI @alexrashed , providing all information:
Below is Docker-compose.yml
I can see proxy registration happening:
localstack_main | 2022-03-30T12:51:54.971:INFO:localstack.services.opensearch.cluster: registering an endpoint proxy for http://localhost.localstack.cloud:4566/opensearch/eu-central-1/dm-demo => http://127.0.0.1:37651 localstack_main | 2022-03-30T12:52:18.048:INFO:localstack.services.opensearch.cluster: [37651] [2022-03-30T12:52:18,048][INFO ][o.o.h.AbstractHttpServerTransport] [2b50ca452773] publish_address {127.0.0.1:37651}, bound_addresses {127.0.0.1:37651} localstack_main | 2022-03-30T12:52:18.194:INFO:localstack.services.opensearch.cluster: cluster on http://127.0.0.1:37651 is ready
Endpoint passed is : "http://localhost.localstack.cloud:4566"
Now, with this "path" approach, when i am trying to save data to index(my-index), it giving me error:
|
Seems like you have a typo in your example:
Does it work if you change the path prefix to the new domain name? |
HI @alexrashed |
#update. |
I'm happy it works for you now. But I just need to stress that there is no such thing as a "LocalStack ElasticSearch". With your commands you actually started an OpenSearch cluster. As mentioned above, AWS and Elastic have a troublesome history and lots of clients which are developed by Elastic are explicitly not compatible with OpenSearch (on purpose). If you want to explicitly start an ElasticSearch cluster, you can so so as well. Here's the docs on our ElasticSearch integration. However, AWS - and therefore LocalStack - will not support any newer ElasticSearch versions than 7.10 (due to their changed license). |
Hi @alexrashed, It looks like you are the expert here! That is why I am pinging you. My question is related a bit to this issue. That is why I am writing here. So... I've configured OpenSearch in LocalStack using Everything works fine and my OpenSearch URL is I have a Spring Boot app that connects perfectly to it when running the app with Maven command. Now, I've dockerized the app. I am running the app Docker container in the same network as LocalStack Docker container. Let's say I've named the LocalStack Docker container as Once inside app Docker container, shouldn't we be able to access OpenSearch through the following URL?
Unfortunately, it's not working. For instance, in the host machine, when calling
Inside app Docker container, when calling
Thanks! |
Hi @ivangfr! |
Thanks @alexrashed! It worked! Sorry for commenting on a closed issue. |
@alexrashed I have a related question if you may: I want to run OpenSearch in LocalStack which I want to run in a Docker container. I don't think I can use the Overall, I have the following docker-compose file:
Running this, and then running inside the localstack container:
This will give me the endpoint for my domain:
Now, I've configured my fluentd as such:
My questions are:
|
Hi @yoav-klein! |
Hi @alexrashed, I think the
Can you explain why these steps are required? Seemingly, I can just run |
Hi @yoav-klein.
In my explanations I chose |
FYI @alexrashed stumbled on this issue from google -- noticed all of the links to documentation that you provided now 404. Would be fantastic if those could be updated! For posterity, I think the link is: https://docs.localstack.cloud/user-guide/aws/opensearch/ |
Is there an existing issue for this?
Question
I am trying to connect to LocalStack OpenSearch with the endpoint provided once domain created.
Steps: I have started localstack as docker container with the below docker-compose file
Created the domain:
aws opensearch create-domain --domain-name my-demo --endpoint-url=http://localhost:4566
Result:
Created Index:
curl -X PUT my-demo.eu-central-1.opensearch.localhost.localstack.cloud:4566/my-index
Result
{"acknowledged":true,"shards_acknowledged":true,"index":"my-index"}
Java/SpringBoot client connection code:
new RestHighLevelClient(RestClient.builder(HttpHost.create(endpoint)));
Model class for index:
Endpoints tried in the connection code:
[This gives connection timeout through java code]
[This also gives connection timeout through java code]
[This gives 500 error.]
[Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.]
Is something i am mistaking here ? or the approach could be different as I am not able to communicate with the Localstack service successfully.
My goal is to mock my opensearch service in local and should be able to connect to Localstack and communicate properly.
Anything else?
No response
The text was updated successfully, but these errors were encountered: