Closed qjhart closed 2 weeks ago
This adds some basic parameters to elasticsearch for production. Basically locking the memory. A much more complete example would have two clients running, and load balance between them.
Chat GPT's example is:
version: '3.7' services: elasticsearch1: image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0 container_name: elasticsearch1 environment: - node.name=elasticsearch1 - cluster.name=my-cluster - discovery.seed_hosts=elasticsearch1,elasticsearch2 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms1g -Xmx1g" ulimits: memlock: soft: -1 hard: -1 expose: - "9200" - "9300" volumes: - esdata1:/usr/share/elasticsearch/data elasticsearch2: image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0 container_name: elasticsearch2 environment: - node.name=elasticsearch2 - cluster.name=my-cluster - discovery.seed_hosts=elasticsearch1,elasticsearch2 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms1g -Xmx1g" ulimits: memlock: soft: -1 hard: -1 expose: - "9200" - "9300" volumes: - esdata2:/usr/share/elasticsearch/data nginx: image: nginx:latest container_name: nginx ports: - "9200:9200" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro depends_on: - elasticsearch1 - elasticsearch2 volumes: esdata1: driver: local esdata2: driver: local
Where the ngninx.conf file is :
events {} http { upstream elasticsearch { server elasticsearch1:9200; server elasticsearch2:9200; } server { listen 9200; location / { proxy_pass http://elasticsearch; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } }
This adds some basic parameters to elasticsearch for production. Basically locking the memory. A much more complete example would have two clients running, and load balance between them.
Chat GPT's example is:
Where the ngninx.conf file is :