Docker-compose部署Elasticsearch和Kibana
Posted 梦里花落知多少
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker-compose部署Elasticsearch和Kibana相关的知识,希望对你有一定的参考价值。
Docker-compose部署Elasticsearch和Kibana
Docker-compose部署Elasticsearch
- 集群
version: \'2.2\'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.2
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.2
container_name: es02
environment:
- node.name=es02s
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data02:/usr/share/elasticsearch/data
networks:
- elastic
- elasticsearch_default
es03:
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.2
container_name: es03
environment:
- node.name=es03
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es02
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data03:/usr/share/elasticsearch/data
networks:
- elastic
volumes:
data01:
driver: local
data02:
driver: local
data03:
driver: local
networks:
elastic:
driver: bridge
- 单节点
# mkdir -p /data/elasticsearch/{config,data,plugins}
# chown -R Bdszxhyun.Bdszxhyun /data/elasticsearch/
$ cat > docker-compose.yaml << EOF version: \'2\' services: elasticsearch: container_name: elasticsearch image: docker.elastic.co/elasticsearch/elasticsearch:7.13.2 ports: - "9200:9200" volumes: - /data/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - /data/elasticsearch/data:/usr/share/elasticsearch/data - /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins environment: - "ES_JAVA_OPTS=-Xms1g -Xmx8g" - "discovery.type=single-node" - "COMPOSE_PROJECT_NAME=elasticsearch-server" restart: always EOF
启动
$ docker-compose up -d
验证
$ curl http://127.0.0.1:9200/
Docker-compose部署kibana
该es上
$ cat > /data/kibana/docker-compose.yaml << EOF version: \'2\' services: kibana: container_name: kibana image: docker.elastic.co/kibana/kibana:7.13.2 ports: - "5601:5601" # volumes: # - /data/kibana/config:/usr/share/kibana/config environment: SERVER_NAME: kibana.lzyun.vip ELASTICSEARCH_URL: http://elasticsearch:9200 restart: always networks: default: external: name: elasticsearch_default EOF
启动
$ docker-compose up -d
或者
docker run --name kibana --net elasticsearch_default -p 5601:5601 -e "ELASTICSEARCH_HOSTS=http://elasticsearch:9200" docker.elastic.co/kibana/kibana:7.13.2
验证
http://172.18.156.177:5601
以上是关于Docker-compose部署Elasticsearch和Kibana的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 docker-compose 将容器部署到谷歌云?
Docker部署Docker-compose部署redis容器及启动失败挂载失败等问题