欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

Docker-compose部署Elasticsearch和Kibana

时间:2023-06-18

前序:

最近工作用到ES和kibana,就了解下安装,写下文档记录下。

Docker安装比较简单些,正好公司用到docker-compose就学习下用该方法进行部署。

1.Docker-compose部署Elasticsearch7.7.0

一、部署Elasticsearch 1.首先拉取镜像

$docker pull elasticsearch:7.7.0

2.配置jvm.options和elasticsearch.yml

Copy这两个文件到当前目录的config目录下

jvm.options说明:

设置jvm堆的大小,最大值和最小值,应该是一致的,并且应该根据你的物理内存决定。

-Xms1g     # 设置最小堆为1g

-Xmx1g # 设置最大堆为1g

elasticsearch.yml配置项参考:https://www.cnblogs.com/bubu99/p/13593839.html

3.通过docker-compose安装

docker-compose.yml

version: '3'

volumes:

es-data:

services:

    elasticsearch:

        image: elasticsearch:7.7.0

        restart: unless-stopped

        volumes:

          - ./config/jvm.options:/usr/share/elasticsearch/config/jvm.options:ro

          - ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro

        ports:

          - "9100:9100"

          - "9200:9200"

          - "9300:9300"

      

        environment:

          ES_JAVA_OPTS: "-Xmx2g -Xms2g"

        networks:

          - aoe

networks:

    aoe:

        driver: bridge

二、启动Elasticsearch和访问Elasticsearch 1、启动Elasticsearch

##当前窗口启动和关闭

$docker-compose up

#ctrl+c就关闭了

##后台启动和停止

$docker-compose up -d

#停止

$docker-compose down

2、访问Elasticsearch

http://10.1.1.191:9200/

 2.Docker-compose部署kibana7.7.0

一、部署kibana 1.首先拉取镜像

$docker pull kibana:7.7.0

 2.配置kibana.yml

Copy这kibana.yml文件到当前目录的config目录下

配置项:

server.port: 5601

server.host: "0.0.0.0"

server.name: "kibana"

elasticsearch.hosts: ["http://10.1.1.191:9200"]

elasticsearch.ssl.verificationMode: none

#elasticsearch.ssl.certificateAuthorities: ["/data/kibana/config/newfile.crt.pem"]

elasticsearch.preserveHost: true

kibana.index: ".kibana"

i18n.locale: "en"

#elasticsearch.username: "elastic"

#elasticsearch.password: "xxxxxx"

3.通过docker-compose安装

version: '3'

volumes:

  mysql-data:

services:

    elasticsearch:

        image: elasticsearch:7.7.0

        restart: unless-stopped

        volumes:

          - ./config/jvm.options:/usr/share/elasticsearch/config/jvm.options:ro

          - ./config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro

        ports:

          - "9100:9100"

          - "9200:9200"

          - "9300:9300"

      

        environment:

          ES_JAVA_OPTS: "-Xmx2g -Xms2g"

        networks:

          - aoe

    kibana:

        image: kibana:7.7.0

        volumes:

          - ./config/kibana.yml:/usr/share/kibana/config/kibana.yml

        ports:

          - '5601:5601'

        privileged: true

networks:

    aoe:

        driver: bridge

二、启动Kibana和访问Kibana 1.启动Kibana

##当前窗口启动和关闭

$docker-compose up

#ctrl+c就关闭了

##后台启动和停止

$docker-compose up -d

#停止

$docker-compose down

2.访问Kibana

http://10.1.1.191:5601/

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。