# How to properly connect a standalone Logstash to an Elasticsearch cluster

**URL:** https://discuss.elastic.co/t/how-to-properly-connect-a-standalone-logstash-to-an-elasticsearch-cluster/322520
**Category:** Logstash
**Created:** [January 5, 2023, 8:38am UTC](https://discuss.elastic.co/t/how-to-properly-connect-a-standalone-logstash-to-an-elasticsearch-cluster/322520 "2023-01-05T08:38:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Francesco1966](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@Francesco1966](https://discuss.elastic.co/u/Francesco1966)
#### Post date: [January 5, 2023, 8:38am UTC](https://discuss.elastic.co/t/how-to-properly-connect-a-standalone-logstash-to-an-elasticsearch-cluster/322520/1 "2023-01-05T08:38:09Z")

</div>

## Hello, I have successfully created an Elasticsearch Cluster with two servers Ubuntu each one running an Elasticsearch node (one ES-Node1 acting as master node and ES-Node2 acting as data node). I than created a Standalone instance of Logstash running on the same server were ES-Node2 is running and I have specified the following in its output plugin\_

```auto
output {
    if [tags][0] == "pipeline" or [tags] == "pipeline" {
        elasticsearch {
            index => "zoa-%{sourceType}-%{host}-%{+YYYYMMdd}"
            pipeline => "%{sourceType}"
            **hosts => "xxxx.xxxx.xxxx.xxxx:9200"**
        }
    } else {
        elasticsearch {
            index => "zoa-%{sourceType}-%{host}-%{+YYYYMMdd}"
            **hosts => "xxxx.xxxx.xxxx.xxxxx:9200"**
            }
    }
file {
      path => "/tmp/test_output_logstash.log"
      }
}

```

where xxxx.xxxx.xxxx designates the ip address of the host where ES-Node2.  
I than run three different tests by sending some data from Logstash to Elasticsearch cluster  
**Test1**  
Both ES-Node1 and ES-Node2 are up and running  
ES nodes receive and index the data being sent (I have used command curl [http://localhost:9200/\_cat/indices](http://localhost:9200/_cat/indices) to verify that)  
**Test2**  
ES-Node1 is up and running while ES-Node2 has been brought down  
No data are received and I get a connection problem with Logstash with ES (that can be expected because of one of the two node is inactive). I would expect that as this is a Cluster having one node active is enough to get the data...  
**Test3**  
ES-Node2 is up and running while ES-Node1 has been brought down  
No data are received and I get a connection problem with Logstash with ES (that can be expected because of one of the two node is inactive). I would expect that as this is a Cluster having one node active is enough to get the data...

So I a m fine with Test1 results but not with Test2 and Test3 as I expect that having at least one node of the cluster active is enough to get the data.....  
Is my Logstash configuration setting properly specified?  
Thanks and bye

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [January 5, 2023, 6:37pm UTC](https://discuss.elastic.co/t/how-to-properly-connect-a-standalone-logstash-to-an-elasticsearch-cluster/322520/2 "2023-01-05T18:37:10Z")

</div>

> [@Francesco1966](#):
>
> two servers Ubuntu each one running an Elasticsearch node (one ES-Node1 acting as master node and ES-Node2 acting as data node)

I don't do elasticsearch much but my understanding is that the cluster needs both master and data nodes. If either is down then the cluster cannot operate. If you want to be able to run with one of the nodes down then do not specify node.roles and let each be general purpose.

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [January 5, 2023, 9:24pm UTC](https://discuss.elastic.co/t/how-to-properly-connect-a-standalone-logstash-to-an-elasticsearch-cluster/322520/3 "2023-01-05T21:24:03Z")

</div>

> [@Francesco1966](#):
>
> I expect that having at least one node of the cluster active is enough to get the data

No, this is not how elasticsearch works, for the cluster to work it needs a healthy and up master node.

To have any kind of resilience you need at least a 3 nodes cluster where both nodes are master and data nodes, in this scenario your cluster will still works if you lose one node, if you lose two nodes, your cluster won't work until the nodes are brought back.

With a 2 node cluster only one can be a master eligible node, if the master eligible node is also a data node, your cluster will still runs if you lose the data only node, but if you lose the master node it will not work.

From what you described you have `Es-Node1` acting as a master only and `Es-Node2` acting as a data node only, your cluster will only work when both nodes are up because you need a up and running master and a up and running data node.

---

<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: [February 2, 2023, 9:24pm UTC](https://discuss.elastic.co/t/how-to-properly-connect-a-standalone-logstash-to-an-elasticsearch-cluster/322520/4 "2023-02-02T21:24:50Z")

</div>

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