Skip to content

Docker image for ElasticSearch (Maestro orchestration)

Notifications You must be signed in to change notification settings

benjaminbarbe/docker-elasticsearch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ElasticSearch on Docker

This Dockerfile creates a Docker image that can be used as the base for running ElasticSearch within a Docker container. It uses the ElasticSearch ZooKeeper discovery plugin instead of the standard Zen multicast discovery to allow for proper operation in PaaS/IaaS/cloud environments that are multicast-hostile. It also offers the AWS Cloud plugin to provide S3 snapshot/restore capability. The run script is responsible for creating the ElasticSearch configuration based on the container's environment and starting the ElasticSearch service.

The version of ElasticSearch used is defined in the Dockerfile and generally points to the latest stable release of ElasticSearch.

Environment variables

The following environment variables are understood by the startup script to seed the service's configuration:

  • SERVICE_NAME should contain the logical name of the service this container is an instance of;

  • CONTAINER_NAME should contain the logical name of the container, which will be used for looking up links and ports informations from the other environment variables. For this, the name is uppercased and non-alphanumeric characters are replaced by underscores. The container name will also be used as the ElasticSearch node name;

  • CONTAINER_HOST_ADDRESS should contain the address of the Docker container's host. It's used by the ElasticSearch ZooKeeper-based discovery plugin as the advertised address for node discovery and is required for the container to start;

  • CLUSTER_NAME, the ElasticSearch cluster name, driving the cluster.name configuration setting. Defaults to local-elasticsearch;

  • ZOOKEEPER_BASE, the ZooKeeper base zNode path to be used by the discovery plugin. Defaults to /local/elasticsearch;

  • <SERVICE_NAME>_INSTANCES, a list of all peer instance container names of that service;

  • <SERVICE_NAME>_<CONTAINER_NAME>_PEER_PORT, the TCP port used by node-to-node communications, driving the transport.tcp.port setting. Defaults to 9300;

  • <SERVICE_NAME>_<CONTAINER_NAME>_HTTP_PORT, the HTTP port for the ElasticSearch REST API, driving the http.port setting. Defaults to 9200;

  • PATH_DATA, the data location path (or list of paths) inside the container (up to you to setup the matching bind-mounts);

  • IS_MASTER_NODE, whether this ElasticSearch instance can be a master node,

  • IS_DATA_NODE, whether this ElasticSearch instance can be a data node (if it's a data node and nothing else, HTTP will be disabled);

  • NUM_INDEX_REPLICAS, the number of index replicas to maintain;

  • NUM_INDEX_SHARDS, the number of shards per index;

  • ZONE_NAME, the logical zone this node is in, which is used for routing awareness affinity and as the AWS region set for the AWS Cloud plugin;

  • AWS_ACCESS_KEY and AWS_SECRET_KEY (self-explanatory), for S3 snapshot/restore access;

  • MARVEL_ENABLED, whether or not to enable Marvel plugin agent reporting from this instance.

ElasticSearch depends on ZooKeeper for discovery. It thus expects the following environment variables for each ZooKeeper node to construct the node list: ZOOKEEPER_INSTANCES, ZOOKEEPER_<ZK_NODE_NAME>_HOST and ZOOKEEPER_<ZK_NODE_NAME>_CLIENT_PORT.

Volumes

The ElasticSearch image uses the following volumes you may want to bind from the container's host:

  • /var/lib/elasticsearch, for the ElasticSearch indices storage.
  • /var/log/elasticsearch, for the ElasticSearch logs (rotated 10 times by 100MB sections).

Usage

To build a new image, simply run from this directory:

$ docker build -t elasticsearch:1.1.0 .

The Docker image will be built and now available for Docker to start a new container from:

$ docker images | grep elasticsearch
elasticsearch   1.1.0              aa4827a39a60        23 minutes ago      12.29 kB (virtual 890.2 MB)

About

Docker image for ElasticSearch (Maestro orchestration)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published