# Configuring Elasticsearch 7 cluster

**URL:** <https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737>\
**Category:** Elasticsearch\
**Created:** [May 25, 2019, 3:44am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737 "2019-05-25T03:44:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hooman\_Bahreini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hooman_bahreini/32/29500_2.png) [@Hooman\_Bahreini](https://discuss.elastic.co/u/Hooman_Bahreini)\
**Post date:** [May 25, 2019, 3:44am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/1 "2019-05-25T03:44:26Z")

</div>

I have three server and I have installed elasticsearch on all of them.

In the elasticsearch.yml I have the following config:

**first server: 172.31.1.1**

```
# /stc/elasticsearch.elasticsearch.yml
cluster.name: es-cluster
node.name: data-1
network.host: 172.31.1.1
http.port: 9200
network.host:
discovery.seed_hosts: ["172.31.1.1", "172.31.1.2", "172.31.1.3"]
cluster.initial_master_nodes:["data-1", "data-2", "data-3"]

gateway.recover_after_nodes: 2
gateway.expected_nodes: 3
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
# some more default values

```

**second server: 172.31.1.2**

```
node.name: data-2
network.host: 172.31.1.2
# everything else same as first server

```

**second server: 172.31.1.3**

```
node.name: data-3
network.host: 172.31.1.3
# everything else same as first server

```

Now when I run: curl [http://data-1:9200/\_cluster/stats](http://data-1:9200/_cluster/stats)

I notice that the cluster size is 1. if I run the same curl command on a different server, again the cluster size is 1 and the cluster\_name is the same, but cluster\_uuid is different...

It seems that nodes are not able to connect to each other...

* * *

I am using Ubuntu server, for node name I edited /etc/hostname and changed the host name to  
data-1 and used the same name in elasticsearch.yml... but it seems that cluster nodes are not able to communicate with one another...

* * *

## Update 1

```
curl http://data-1:9200/_cat/health
prod-es-cluster red 1 1 0 0 0 0 0 0 - NaN%

curl http://data-1/:9200/_cat/nodes
172.31.1.1 8 38 1 0.03 0.03 0.00 mdi * ip-172-31-1-1

```

I just check the log and it's strange...

```
sudo cat /var/log/elasticsearch/elasticsearch.log
[INFO][o.e.n.Node] [data-1] stopping ...
[INFO][o.e.x.w.WatcherService] [data-1] stopping watch service, reason [shutdown initiated]
[INFO][o.e.x.m.p.l.CppLogMessageHandler] [data-1] [controller/19159] [Main.cc@148] Ml controller exiting
[INFO][o.e.x.m.p.NativeController] [data-1] Native controller process has stopped - no new native processes can be started
[INFO][o.e.n.Node] [data-1] stopped
[INFO][o.e.n.Node] [data-1] closing ...
[INFO][o.e.n.Node] [data-1] closed

```

That is all written to the log file... after restarting Elasticsearch nothing new gets added to the log file... it feels like I am either reading the wrong log file or I have put the configuration in the wrong .yml file

## Update 2

This is how I start the service:

```
sudo /bin/systemctl enable elasticsearch.service

```

## Update 3

As pointed out by @hamidbayat, I think there is permission issues. Only super user have permission to /var/lib/elasticsearch

If I try to run elastic search as my ubuntu user I will get this error:

```
ubuntu@my-ip:~$ /usr/share/elasticsearch/bin/elasticsearch
/usr/share/elasticsearch/bin/elasticsearch-env: line 73: 
/etc/default/elasticsearch: Permission denied

```

If I try to run it as root, I will get this error:

```
ubuntu@myip:~$ sudo /usr/share/elasticsearch/bin/elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[data][WARN][o.e.b.ElasticsearchUncaughtExceptionHandler] [data-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.1.0.jar:7.1.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.1.0.jar:7.1.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.1.0.jar:7.1.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.1.0.jar:7.1.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.1.0.jar:7.1.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.1.0.jar:7.1.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.1.0.jar:7.1.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:102) ~[elasticsearch-7.1.0.jar:7.1.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:169) ~[elasticsearch-7.1.0.jar:7.1.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:325) ~[elasticsearch-7.1.0.jar:7.1.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.1.0.jar:7.1.0]
        ... 6 more
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 25, 2019, 7:35am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/2 "2019-05-25T07:35:22Z")

</div>

Is it a typo? This blank line:

```
network.host: 

```

What are the logs?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 25, 2019, 8:03am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/3 "2019-05-25T08:03:08Z")

</div>

> [@Hooman\_Bahreini](#):
>
> but cluster\_uuid is different

This means that the first time these nodes started they formed separate clusters. Perhaps the config was different the first time around. You cannot merge two separate clusters together.

Are these nodes empty of data? If so, I think the simplest path forwards is to leave `data-1` alone, but to shut down `data-2` and `data-3`, wipe their data paths, and restart them.

---

<div class="post-metadata">

**Author:** ![Hooman\_Bahreini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hooman_bahreini/32/29500_2.png) [@Hooman\_Bahreini](https://discuss.elastic.co/u/Hooman_Bahreini)\
**Post date:** [May 25, 2019, 8:31am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/4 "2019-05-25T08:31:25Z")

</div>

@dadoonet: thanks for your message, yes that was a typo, fixed. It looks like a permission issue... I have not fixed the problem yet but I think the scope of the problem is narrowed down now.

---

<div class="post-metadata">

**Author:** ![Hooman\_Bahreini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hooman_bahreini/32/29500_2.png) [@Hooman\_Bahreini](https://discuss.elastic.co/u/Hooman_Bahreini)\
**Post date:** [May 25, 2019, 8:34am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/5 "2019-05-25T08:34:16Z")

</div>

@DavidTurner: thanks a lot. I think I have some permission issue as elasticsearch is not writing to log file... I have updated the question... I will follow your suggestion once I get the permission issue sorted.

---

<div class="post-metadata">

**Author:** ![Hooman\_Bahreini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hooman_bahreini/32/29500_2.png) [@Hooman\_Bahreini](https://discuss.elastic.co/u/Hooman_Bahreini)\
**Post date:** [May 25, 2019, 10:45am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/6 "2019-05-25T10:45:56Z")

</div>

@dadoonet, I have updated the question... it seems like a permission issue as elasticsearch is not able to write to log files/

---

<div class="post-metadata">

**Author:** ![Hooman\_Bahreini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hooman_bahreini/32/29500_2.png) [@Hooman\_Bahreini](https://discuss.elastic.co/u/Hooman_Bahreini)\
**Post date:** [May 25, 2019, 10:46am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/7 "2019-05-25T10:46:40Z")

</div>

@DavidTurner: I have updated the question, seem like a permission issue to write to log file.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 25, 2019, 6:23pm UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/8 "2019-05-25T18:23:35Z")

</div>

You have changed your question to a **completely different question** which isn't very helpful. Anyone coming to this thread later will be mystified by how the answers you've already received don't match up any more, which is a shame because they might have helped another reader if only you'd left the question intact. Please would you set it back to how it was originally, and ask your new question separately?

---

<div class="post-metadata">

**Author:** ![Hooman\_Bahreini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hooman_bahreini/32/29500_2.png) [@Hooman\_Bahreini](https://discuss.elastic.co/u/Hooman_Bahreini)\
**Post date:** [May 25, 2019, 10:37pm UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/9 "2019-05-25T22:37:22Z")

</div>

@DavidTurner: apologies, I was only thinking about solving my own problem... did not think about it... I have reverted the question.

---

<div class="post-metadata">

**Author:** ![Hooman\_Bahreini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hooman_bahreini/32/29500_2.png) [@Hooman\_Bahreini](https://discuss.elastic.co/u/Hooman_Bahreini)\
**Post date:** [May 26, 2019, 5:30am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/10 "2019-05-26T05:30:15Z")

</div>

@DavidTurner: how to delete the data path? at the moment my data path (/var/lib/elasticsearch) contains nodes directory... should I delete nodes directory and it's content?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 26, 2019, 8:00am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/11 "2019-05-26T08:00:41Z")

</div>

> [@Hooman\_Bahreini](#):
>
> should I delete nodes directory and it's content

Yes, that'd do it.

---

<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:** [June 23, 2019, 8:06am UTC](https://discuss.elastic.co/t/configuring-elasticsearch-7-cluster/182737/12 "2019-06-23T08:06:07Z")

</div>

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