Docker 运行ES和Kibana

1. 下载镜像

docker pull elasticsearch:7.5.0
docker pull mobz/elasticsearch-head:5 docker pull kibana:7.5.0


2. 启动es

 docker run -it --name elasticsearch -d -p 9200:9200 -p 9300:9300 -p 5601:5601 elasticsearch:7.5.0

    注意事项
   - kibana的container共用elasticsearch的网络
   - elasticsearch服务有跨域问题,导致elasticsearch-head无法连接到ES,因此需要进入ES容器修改配置
     - docker exec -it elasticsearch /bin/bash
     - vi config/elasticsearch.yml
        - 加入跨域配置
        http.cors.enabled: true
        http.cors.allow-origin: "*"
     - docker restart elasticsearch


3. 启动Kibana

 - kibana的container共用elasticsearch的网络
    docker run -it -d -e ELASTICSEARCH_URL=http://127.0.0.1:9200 --name kibana --network=container:elasticsearch kibana:7.5.0


4. 启动elasticsearch-head

docker run -it --name elasticsearch-head -d -p 9100:9100 docker.io/mobz/elasticsearch-head:5

 

posted @ 2020-07-23 10:24  風をした  阅读(321)  评论(0编辑  收藏  举报