# Help in Creating a Cluster

**URL:** <https://discuss.elastic.co/t/help-in-creating-a-cluster/183784>\
**Category:** Elasticsearch\
**Created:** [May 31, 2019, 6:48pm UTC](https://discuss.elastic.co/t/help-in-creating-a-cluster/183784 "2019-05-31T18:48:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryh](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryh](https://discuss.elastic.co/u/ryh)\
**Post date:** [May 31, 2019, 6:48pm UTC](https://discuss.elastic.co/t/help-in-creating-a-cluster/183784/1 "2019-05-31T18:48:14Z")

</div>

Hi All,

I'm trying to create an elasticsearch cluster but wasn't sure how to go about it.

Here's a brief overview of our stack.

SERVER 1 - runs a python app with elasticsearch in the background  
SERVER 2 - ELK stack

What should be the configuration for server 1 and server 2 so that I'm able to cluster them properly?

Thanks in advance,  
Ry

---

<div class="post-metadata">

**Author:** ![jakelandis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakelandis/32/36163_2.png) [@jakelandis](https://discuss.elastic.co/u/jakelandis)\
**Post date:** [May 31, 2019, 7:44pm UTC](https://discuss.elastic.co/t/help-in-creating-a-cluster/183784/2 "2019-05-31T19:44:24Z")

</div>

If you are just getting started with Elasticsearch, I would suggest to start with Docker or Docker compose _([or Elastic Cloud](https://cloud.elastic.co))_. Full Docker examples can be found here: [Install Elasticsearch with Docker | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html)

Logstash and Kibana also have docker images you can use to setup a full ELK stack.

Also, here is the python client library: [Python Elasticsearch Client — Elasticsearch 8.0.0 documentation](https://elasticsearch-py.readthedocs.io/en/master/)

> What should be the configuration for server 1 and server 2 so that I'm able to cluster them properly?

The cluster settings to form a cluster can be found here for 7x: [https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/discovery-settings.html)

... and here for 6.x : [Discovery settings | Elasticsearch Guide [6.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/discovery-settings.html) (they are similar, but not identical)

---

<div class="post-metadata">

**Author:** ![ryh](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryh](https://discuss.elastic.co/u/ryh)\
**Post date:** [May 31, 2019, 7:59pm UTC](https://discuss.elastic.co/t/help-in-creating-a-cluster/183784/3 "2019-05-31T19:59:06Z")

</div>

Thanks for the reply.

Unfortunately, I cannot use docker-compose because we don't have a separate container just for an elasticsearch per application.

Our goal is to have an application and an elasticsearch installed in one container.

Do you have any idea how to locally build a cluster? I ran a custom image with elasticsearch in it by doing the following: `sudo docker run -e -i -t -v /opt/dicts/spitz/latest:/opt/dicts/spitz/latest --net=host gsw/mimidae:latest` and an image `sudo docker run -p 5601:5601 -p 9201:9200 -p 5044:5044 -it -e LOGSTASH_START=0 -e KIBANA_START=0 --name elk sebp/elk`

If I removed the option --net=host and replaced it with the options `-p 9200:9200 -p 9300:9300`, I'm unable to curl the container's port. Same issue with my elk container.

Thanks,  
Ry

---

<div class="post-metadata">

**Author:** ![jakelandis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jakelandis/32/36163_2.png) [@jakelandis](https://discuss.elastic.co/u/jakelandis)\
**Post date:** [May 31, 2019, 9:25pm UTC](https://discuss.elastic.co/t/help-in-creating-a-cluster/183784/4 "2019-05-31T21:25:16Z")

</div>

If you want to cluster via docker run this should work (7x) :

```auto
docker network create my-net && 
docker run -d -p 9200:9200 --name es1 --network my-net \
            -e "node.name=es1" \
            -e "discovery.seed_hosts=es1,es2" \
            -e "cluster.initial_master_nodes=es1,es2" \
                 elastic/elasticsearch:7.1.1 &&
docker run -d -p 9201:9200 --name es2 --network my-net \
            -e "node.name=es2" \
            -e "discovery.seed_hosts=es1,es2" \
            -e "cluster.initial_master_nodes=es1,es2" \
                 elastic/elasticsearch:7.1.1 &&
watch -n 5 curl -v localhost:9200/_cat/nodes                 

```

- note any other docker containers need to use same network, or route requests through the host

---

<div class="post-metadata">

**Author:** ![ryh](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryh](https://discuss.elastic.co/u/ryh)\
**Post date:** [June 3, 2019, 6:49pm UTC](https://discuss.elastic.co/t/help-in-creating-a-cluster/183784/5 "2019-06-03T18:49:59Z")

</div>

Thanks.

---

<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 1, 2019, 6:50pm UTC](https://discuss.elastic.co/t/help-in-creating-a-cluster/183784/6 "2019-07-01T18:50:13Z")

</div>

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