# Elastic Search 5 on Microsoft Azure Connection Failure

**URL:** <https://discuss.elastic.co/t/elastic-search-5-on-microsoft-azure-connection-failure/89982>\
**Category:** Elasticsearch\
**Created:** [June 19, 2017, 6:08pm UTC](https://discuss.elastic.co/t/elastic-search-5-on-microsoft-azure-connection-failure/89982 "2017-06-19T18:08:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pranita984](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@pranita984](https://discuss.elastic.co/u/pranita984)\
**Post date:** [June 19, 2017, 6:08pm UTC](https://discuss.elastic.co/t/elastic-search-5-on-microsoft-azure-connection-failure/89982/1 "2017-06-19T18:08:02Z")

</div>

I am new to elastic search and I have created a 3 node elastic search cluster in Microsoft Azure using the "Elastic Stack" template. But I am not able to connect to the cluster using connection pool or using a single node connection.

Here's my code:  
var uris = new[]  
{  
new Uri("http://\<\>:9200")  
};

```
            var connectionPool = new SniffingConnectionPool(uris);

            var settings = new ConnectionSettings(connectionPool)
                .SniffOnConnectionFault(false)
                .SniffOnStartup(false)
                .RequestTimeout(TimeSpan.FromSeconds(500))
                .PingTimeout(TimeSpan.FromSeconds(500))
                .MaximumRetries(5)
                .DefaultIndex("people");

            var client = new ElasticClient(settings);

```

It gives me the error:  
FailureReason: PingFailure while attempting PUT on http://\<\>:9200/people/person/1

# Audit trail of this API call:

# OriginalException: System.Net.WebException: Unable to connect to the remote server ---\> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.2.4:9200

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)  
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)  
--- End of inner exception stack trace ---  
at System.Net.HttpWebRequest.GetResponse()  
at Elasticsearch.Net.HttpConnection.Request[TReturn](RequestData requestData)

# Request:

\<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.\>

# Response:

\<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.\>

# Inner Exception: One or more errors occurred.

System.AggregateException: One or more errors occurred. ---\> Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---\> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node.  
at Elasticsearch.Net.RequestPipeline.Ping(Node node)  
--- End of inner exception stack trace ---  
at Elasticsearch.Net.RequestPipeline.Ping(Node node)  
at Elasticsearch.Net.Transport`1.Ping(IRequestPipeline pipeline, Node node) at Elasticsearch.Net.Transport`1.Request[TReturn](HttpMethod method, String path, PostData`1 data, IRequestParameters requestParameters) --- End of inner exception stack trace --- ---> (Inner Exception #0) Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node. at Elasticsearch.Net.RequestPipeline.Ping(Node node) --- End of inner exception stack trace --- at Elasticsearch.Net.RequestPipeline.Ping(Node node) at Elasticsearch.Net.Transport`1.Ping(IRequestPipeline pipeline, Node node)  
at Elasticsearch.Net.Transport`1.Request[TReturn](HttpMethod method, String path, PostData`1 data, IRequestParameters requestParameters)\<---

# Exception:

Elasticsearch.Net.ElasticsearchClientException: One or more errors occurred. ---\> System.AggregateException: One or more errors occurred. ---\> Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---\> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node.  
at Elasticsearch.Net.RequestPipeline.Ping(Node node)  
--- End of inner exception stack trace ---  
at Elasticsearch.Net.RequestPipeline.Ping(Node node)  
at Elasticsearch.Net.Transport`1.Ping(IRequestPipeline pipeline, Node node) at Elasticsearch.Net.Transport`1.Request[TReturn](HttpMethod method, String path, PostData`1 data, IRequestParameters requestParameters)  
--- End of inner exception stack trace ---  
--- End of inner exception stack trace ---

Any suggestions , what I could be missing?

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [June 20, 2017, 6:35am UTC](https://discuss.elastic.co/t/elastic-search-5-on-microsoft-azure-connection-failure/89982/2 "2017-06-20T06:35:01Z")

</div>

> OriginalException: System.Net.WebException: Unable to connect to the remote server ---\> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.2.4:9200

It looks like your trying to connect to the node through its local IP address rather than through a public IP address.

If you're using **[Elastic's Azure ARM template](https://github.com/elastic/azure-marketplace)** to deploy a cluster, you'll need to deploy either an external load balancer or Application Gateway in order to connect to the cluster from outside of the virtual network;

**If you're deploying through the Azure Marketplace portal** :

 ![](https://us1.discourse-cdn.com/elastic/original/3X/e/d/ed1a8fa50418495a92ccef1ccb741f4c624b8568.png)

**if you're deploying through Azure CLI or PowerShell** :

You can specify the `loadBalancerType` as either `external` for external load balancer or `gateway` for Application Gateway.

You may also find the [blog post on deploying Elasticsearch and Kibana to Azure](https://www.elastic.co/blog/elasticsearch-and-kibana-deployments-on-azure) useful.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 18, 2017, 6:35am UTC](https://discuss.elastic.co/t/elastic-search-5-on-microsoft-azure-connection-failure/89982/3 "2017-07-18T06:35:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
