« Install Elasticsearch with Windows MSI Installer Configuring Elasticsearch »
Install Elasticsearch with Dockeredit
Elasticsearch is also available as Docker images. The images use centos:7 as the base image.
A list of all published Docker images and tags is available at www.docker.elastic.co. The source files are in Github.
These images are free to use under the Elastic license. They contain open source and free commercial features and access to paid commercial features. Start a 30-day trial to try out all of the paid commercial features. See the Subscriptions page for information about Elastic license levels.
Pulling the imageedit
Obtaining Elasticsearch for Docker is as simple as issuing a docker pull command against the Elastic Docker registry.
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.7.2
Alternatively, you can download other Docker images that contain only features available under the Apache 2.0 license. To download the images, go to www.docker.elastic.co.
Running Elasticsearch from the command lineedit
Development modeedit
Elasticsearch can be quickly started for development or testing use with the following command:
docker run -p 9200:9200 -p 9300:9300 -e “discovery.type=single-node” docker.elastic.co/elasticsearch/elasticsearch:6.7.2
Production modeedit
Important
The vm.max_map_count kernel setting needs to be set to at least 262144 for production use. Depending on your platform:
Linux
The vm.max_map_count setting should be set permanently in /etc/sysctl.conf:
$ grep vm.max_map_count /etc/sysctl.conf
vm.max_map_count=262144
To apply the setting on a live system type: sysctl -w vm.max_map_count=262144
macOS with Docker for Mac
The vm.max_map_count setting must be set within the xhyve virtual machine:
$ screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
Just press enter and configure the sysctl setting as you would for Linux:
sysctl -w vm.max_map_count=262144
Windows and macOS with Docker Toolbox
The vm.max_map_count setting must be set via docker-machine:
docker-machine ssh
sudo sysctl -w vm.max_map_count=262144
The following example brings up a cluster comprising two Elasticsearch nodes. To bring up the cluster, use the docker-compose.yml and just type:
docker-compose up
Note
docker-compose is not pre-installed with Docker on Linux. Instructions for installing it can be found on the Docker Compose webpage.
The node elasticsearch listens on localhost:9200 while elasticsearch2 talks to elasticsearch over a Docker network.
This example also uses Docker named volumes,