Elasticsearch cluster setup for web application

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Elasticsearch cluster setup for web application
Complex
~3-5 business days
FAQ

Our competencies:

Development stages

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1171
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1094
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    831
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    879
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    453

Elasticsearch Cluster Setup

Elasticsearch cluster is multiple nodes coordinating indexing and search. Single node is risky: data loss on server failure, no shard distribution. Minimum production cluster: 3 nodes (master quorum = 2).

Docker Compose Cluster

version: '3.8'
services:
  es-master-1:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
    environment:
      - cluster.name=prod-cluster
      - node.name=master-1
      - node.roles=master,data
      - discovery.seed_hosts=es-master-1,es-master-2,es-master-3
      - cluster.initial_master_nodes=master-1,master-2,master-3
      - xpack.security.enabled=false
      - ES_JAVA_OPTS=-Xms2g -Xmx2g
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - "9201:9200"
    healthcheck:
      test: curl -s http://localhost:9200/_cluster/health | grep status
      interval: 10s
      timeout: 5s
      retries: 5

  es-master-2:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
    environment:
      - cluster.name=prod-cluster
      - node.name=master-2
      - node.roles=master,data
      - discovery.seed_hosts=es-master-1,es-master-2,es-master-3
      - cluster.initial_master_nodes=master-1,master-2,master-3
      - xpack.security.enabled=false
      - ES_JAVA_OPTS=-Xms2g -Xmx2g
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    ports:
      - "9202:9200"

  es-master-3:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
    environment:
      - cluster.name=prod-cluster
      - node.name=master-3
      - node.roles=master,data
      - discovery.seed_hosts=es-master-1,es-master-2,es-master-3
      - cluster.initial_master_nodes=master-1,master-2,master-3
      - xpack.security.enabled=false
      - ES_JAVA_OPTS=-Xms2g -Xmx2g
    volumes:
      - esdata3:/usr/share/elasticsearch/data
    ports:
      - "9203:9200"

  kibana:
    image: docker.elastic.co/kibana/kibana:8.11.0
    ports:
      - "5601:5601"
    environment:
      - ELASTICSEARCH_HOSTS=http://es-master-1:9200

volumes:
  esdata1:
  esdata2:
  esdata3:

Cluster Health Verification

curl -s http://localhost:9200/_cluster/health | jq

# Output:
# {
#   "cluster_name": "prod-cluster",
#   "status": "green",           # green = all shards allocated
#   "timed_out": false,
#   "number_of_nodes": 3,
#   "number_of_data_nodes": 3,
#   "active_primary_shards": 5,
#   "active_shards": 10
# }

Shard Strategy

# For an index with 100 GB data, 3 nodes:
# - 3 primary shards (one per node)
# - 2 replicas (total 9 shards)

curl -X PUT "localhost:9200/my_index" \
  -H 'Content-Type: application/json' \
  -d '{
    "settings": {
      "number_of_shards": 3,
      "number_of_replicas": 2,
      "index.refresh_interval": "30s"
    }
  }'

Node Roles

# Master node (elect leaders)
node.roles: [ master ]

# Data node (store shards)
node.roles: [ data ]

# Ingest node (preprocess documents)
node.roles: [ ingest ]

# Combined (all roles)
node.roles: [ master, data, ingest ]