docker pull docker.elastic.co/elasticsearch/elasticsearch:7.11.2
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.11.2
if already have the elasticsearch docker image locally
sudo docker run --rm -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name elasticsearch --net searchnetwork elasticsearch:7.13.4
check network by following command
sudo network ls
kibna and elasticsearch must be in same network
create network by
sudo create network my_net
###########################
# ELK SERVICES NODE 1
###########################
els1:
image: docker.elastic.co/elasticsearch/${ELK_VERSION}
restart: always
healthcheck:
start_period: 60ms
timeout: 130ms
interval: 30ms
test: ifconfig | grep broadcast && clear
ports:
- 9200:9200
env_file: .env
environment:
- node.name=els1
- cluster.name=els-docker-cluster
- cluster.initial_master_nodes=els1,els2,els3
- discovery.seed_hosts=els2,els3
- discovery.zen.minimum_master_nodes=2
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- els1-data:/usr/share/elasticsearch/data
networks:
- node_networks
###########################
# ELK SERVICES NODE 2
###########################
els2:
image: docker.elastic.co/elasticsearch/${ELK_VERSION}
restart: always
healthcheck:
start_period: 60ms
timeout: 130ms
interval: 30ms
test: ifconfig | grep broadcast && clear
ports:
- 9300:9200
env_file: .env
environment:
- node.name=els2
- cluster.name=els-docker-cluster
- cluster.initial_master_nodes=els1,els2,els3
- discovery.seed_hosts=els1,els3
- discovery.zen.minimum_master_nodes=2
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- els2-data:/usr/share/elasticsearch/data
networks:
- node_networks
###########################
# ELK SERVICES NODE 3
###########################
els3:
image: docker.elastic.co/elasticsearch/${ELK_VERSION}
restart: always
healthcheck:
start_period: 60ms
timeout: 130ms
interval: 30ms
test: ifconfig | grep broadcast && clear
ports:
- 9400:9200
env_file: .env
environment:
- node.name=els3
- cluster.name=els-docker-cluster
- cluster.initial_master_nodes=els1,els2,els3
- discovery.seed_hosts=els1,els2
- discovery.zen.minimum_master_nodes=2
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- els3-data:/usr/share/elasticsearch/data
networks:
- node_networks