Giter VIP home page Giter VIP logo

docker-elasticsearch-marathon's Introduction

elasticsearch-marathon

A Marathon-enabled Docker instance containing ElasticSearch.

Sample Configuration

As decribed in https://mesosphere.github.io/marathon/docs/rest-api.html#post-/v2/apps we need to fire a POST request to the /v2/apps endpoint to create a new application.

So, if your Marathon instance is running at http://127.0.0.1:8080 your request could look like the one below. Please set the correct parameters values for your individual configuration.

curl -XPOST 'http://127.0.0.1:8080/v2/apps' -d '{
    "id": "es-cluster",
    "env": {
	"MARATHON_URL": "http://127.0.0.1:8080",
	"APP_ID": "es-cluster",
	"ELASTICSEARCH_CLUSTER_NAME": "MYCLUSTER"
    },
    "container": {
        "docker": {
            "image": "tobilg/elasticsearch-marathon",
            "network": "BRIDGE",
            "portMappings": [
                { "containerPort": 9200 },
                { "containerPort": 9300 }
            ]
        },
        "type": "DOCKER"
    },
    "cpus": 0.5,
    "mem": 2048,
    "instances": 2
}'

How it works

Upon the container startup, the shell script elasticsearch-marathon-bootstrap.sh is executed, which first calls another Node.js script (elasticsearches.js) to query the Marathon REST API to get the list of tasks for the given app id.

The resulting node list is then fed into the ElasticSearch startup script parameter discovery.zen.ping.unicast.hosts, thus enabling the ElasticSearch unicast discovery to build a cluster.

This is done dynamically at instance start, meaning that if you scale the application via the Marathon frontend, the further instances are automatically added to the given cluster (which name is set via the ELASTICSEARCH_CLUSTER_NAME environment variable in the config JSON, see above).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.